Introduction
A type system is a logical system comprising a set of rules that assigns a property called a type [1]. According to Pierce, “A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute.” [2]. In various DBMS, type systems are needed to ensure the integrity and consistency of the stored data. They define the types of data that can be stored in the database, as well as the rules for manipulating this data. Such rules can be different, like unique constraints, foreign key constraints, and various invariants that help guarantee consistency and accuracy of data, or any others depending on the type of DBMS. In this essay, we will consider type systems in relational databases and several types of non-relational databases, such as document-oriented, geospatial and graph databases.
Main part
Relational DBMS
The type system in SQL DBMS is a set of rules and standards that define the data types that can be used for columns in a database table. Data types can be as follows: numeric types (integer, decimal, and etc), character types (char and varchar), date and time types, and binary types. The relational (SQL) DBMS type system also includes working with unique constraints that ensure that each row in the table has a unique value for the specified column. It also supports foreign key constraints that ensure referential integrity between tables [3].
Document-oriented DBMS
Document-oriented DBMSs often have flexible type systems that allow dynamic schema changes. This means that new fields can be added to documents in the process of working with the database, without requiring any predefined schema or data migration. This is convenient for applications that deal with unstructured or semi-structured data, as well as when working with data that is differently structured. In some times it can rocket the performance of the database [4]. Another advantage of the type system in such DBMS is its indexing support. By indexing certain types of data, it can improve the performance of their queries and simplify the search for specific data in the database. A good example of working with NoSQL DBMS is designing your own DBMS that meets specific conditions and achieved goals. And any DBMS with its type system can not meet the requirements in a case of working with large RDF files. So, new DBMS and new type system was designed. In the designed PolarDB DBMS, there are complex types in the type system, such as record, sequence, union. In this case, the type system has only the necessary entities for the work being performed [5].
Geospatial DBMS
In geospatial DBMS, the type system is used to determine the types of spatial data. This allows efficient data storage and retrieval, and ensures consistency and accuracy of spatial data. Geo DBMS typically support a number of spatial data types, including points, lines, polygons, and multidimensional geometries. They also have their own data types for working with artificial objects: points (Points3D), curves (Curves3D), surfaces (Surface3D), and so on [6]. In addition, the type system in geospatial DBMS can help ensure the consistency and integrity of spatial data by applying constraints and checks. For example, by using constraints that require certain columns to be non-zero or that prevent the insertion of overlapping or invalid geometries.
Graph DBMS
The type system in graph databases is designed to take into account the unique structure of graph data. It usually includes node and edge types, as well as property types for each node and edge. These types can be used to determine the diagram of the graph, which allows you to verify the validity of the data and their consistency. Node types represent various objects on the graph that are stored in the DBMS, for example, users and information about them. Edge types represent relationships between nodes. Each edge has a source node, a target node, and a label describing the relationship between them. By defining these types and their relationships, graph databases can impose constraints on data and ensure that they remain consistent and valid. The type system in graph databases also allows you to create constraints and checks to ensure data consistency and integrity. For example, developers can create constraints that require the presence of certain properties both in the nodes and in the edges connecting them. This ensures that only reliable data is stored on the graph, and prevents inconsistencies or errors. In addition, the type system in graph databases can support complex queries and traversals, allowing to define hierarchies and inheritance. This provides a more efficient query and graph traversal, as well as simplifies data modeling and schema development [7].
Conclusion
Thus, different DBMS have different approaches to their type systems depending on the data they are intended to store. Relational databases use a static schema, which means that the structure of the database and its tables must be defined in advance. This helps to ensure data consistency and simplify the execution of complex queries, but limits flexibility. Document-oriented databases use a dynamic schema that provides greater flexibility in data modeling. Graph databases have a specialized type system designed to work with graphs – nodes, edges and properties, as well as specialized indexing and traversal functions. The type system in geospatial DBMS is an important tool for developers, providing consistency and accuracy of spatial data, support for efficient query and analysis of spatial data, as well as allowing efficient data modeling and schema development. To conclude, it is difficult to compare type systems because of unsimilar purposes of different DBMS. Even more, in specific cases for specific purposes there can be no appliable DBMS and its type system, so your own DBMS and its type system fits best to its purposes.
References
- Wikipedia contributors. (2023). Type system. Wikipedia. https://en.wikipedia.org/wiki/Type_system
- Pierce, B. C. (2002). Types and programming languages. MIT Press.
- Beynon‐Davies, P. (2004). SQL — Data Definition. In Database Systems (pp. 157–167). https://doi.org/10.1007/978-0-230-00107-7_11
- Николай. (2020). Особенности проектирования модели данных для NoSQL. Хабр. https://habr.com/ru/articles/504166/
- Marchuk, A. (2016). PolarDB: An infrastructure for specialized NoSQL datebases and DBMS. Automatic Control and Computer Sciences, 50(7), 493–496. https://doi.org/10.3103/s0146411616070142
- Breunig, M., & Zlatanova, S. (2005). 3D Geo-DBMS. In CRC Press eBooks. https://doi.org/10.1201/9781420036282-5
- Paul, S., Mitra, A., & Koner, C. (2019). A Review on Graph Database and its representation. 2019 International Conference on Recent Advances in Energy-efficient Computing and Communication (ICRAECC), 1–5. https://doi.org/10.1109/icraecc43874.2019.8995006