Sobes.tech
Junior

What types of databases exist?

sobes.tech AI

Answer from AI

Databases are classified by several features, the main types:

  1. Relational (SQL-oriented):

    • Data is stored in tables with rows and columns.
    • Relationships between tables are defined by primary and foreign keys.
    • SQL language is used for queries.
    • Examples: PostgreSQL, MySQL, Oracle, SQL Server.
  2. Non-relational (NoSQL):

    • Differ from relational with flexible schemas and horizontal scaling.
    • There are different data models:
      • Key-value: Redis, Memcached.
      • Document-oriented: MongoDB, Couchbase.
      • Wide-column: Cassandra, HBase.
      • Graph: Neo4j, ArangoDB.
  3. In-Memory:

    • Data is stored directly in RAM for fast access.
    • Can be relational or NoSQL.
    • Examples: Redis, Memcached, SAP HANA.
  4. Time Series:

    • Optimized for storing and analyzing data arriving in chronological order.
    • Examples: InfluxDB, TimescaleDB.
  5. Multi-model:

    • Supports multiple data models simultaneously (e.g., document and graph).
    • Examples: ArangoDB, OrientDB.
  6. Spatial:

    • Optimized for storing and querying data with geographic coordinates.
    • Often extensions of relational or NoSQL DBMS (e.g., PostGIS for PostgreSQL).
  7. Master-Slave:

    • Architectural pattern for data replication. One node (master) handles writes, others (slaves) only read and synchronize with master. Used for read scaling and fault tolerance.
  8. Sharded:

    • Data is distributed across multiple independent nodes (shards). Used for horizontal scaling and handling large data volumes.

Comparison table of relational and non-relational DBs (main differences):

Characteristic Relational (SQL) Non-relational (NoSQL)
Schema Rigid, predefined Flexible, dynamic
Scaling Vertical (more difficult horizontal) Horizontal (easier)
Data integrity ACID (usually) BASE (more often)
Data model Tables Key-value, document, graph, etc.
Query language SQL Various (API, specific)