What types of non-relational databases exist and for what tasks are they used? How do they differ from relational databases?
sobes.tech AI
Answer from AI
Non-relational databases (NoSQL) differ from relational ones in that they do not use fixed-schema tables and SQL for queries. They are more flexible and scalable, suitable for large volumes of data and distributed systems.
Main types of non-relational databases:
-
Document-oriented (e.g., MongoDB, CouchDB) — store data in document formats (JSON, BSON). Good for applications with dynamic data structures.
-
Key-value (e.g., Redis, Riak) — simple model where data is stored by key. Used for caching, sessions, fast operations.
-
Column-oriented (e.g., Cassandra, HBase) — data is stored by columns, which speeds up analytical queries on large datasets.
-
Graph (e.g., Neo4j, JanusGraph) — optimized for storing and processing graphs, social networks, relationships between objects.
Differences from relational:
- No fixed schema (schema-less or schema-flexible).
- Easier horizontal scaling.
- Support different data models, not just tables.
- Usually do not support complex ACID transactions but provide high availability and speed.
Example: for a social network, a graph database is convenient for storing user relationships, and for session caching, a key-value store is suitable.