Types of Databases Every Developer Should Know
Modern software systems rarely rely on a single database technology. A social media platform might use a relational database for user accounts, a graph database for friend recommendations, a key-value store for session caching, and a search engine for post content. Each type of database solves a specific set of problems, and understanding the landscape of database categories is essential for making sound architectural decisions.
This article introduces the major database types you will encounter in production systems. Instead of memorizing product names, focus on understanding the core data model, typical use cases, and trade-offs of each category. This mental framework stays with you as tools evolve.
Why So Many Database Types Exist​
Different workloads place different demands on a data store. The forces that shape a database category include:
- Online transaction processing (OLTP) — high volumes of short, atomic operations on structured data (e.g., placing an order). Requires strong consistency and the ability to handle many concurrent users.
- Online analytical processing (OLAP) — complex aggregations across large datasets (e.g., monthly sales reports). Optimised for scanning millions of rows quickly, often at the expense of fast individual updates.
- Full-text search — finding documents based on natural language queries with typo tolerance and relevance ranking. Requires specialised indexing structures like inverted indexes.
- Caching — storing frequently accessed data in memory to reduce load on a primary database. Latency must be measured in microseconds, and the data model is simple key-value.
- Graph relationships — queries that involve deep connections between entities (e.g., "friends of friends who liked this movie"). Relational joins become exponentially expensive, while graph traversal algorithms remain efficient.
- Time-series data — massive streams of time-stamped measurements (e.g., server CPU every second). Requires high write throughput and built-in functions for time-based aggregation and retention.
- AI and vector search — finding semantically similar items by comparing high-dimensional embedding vectors. This requires approximate nearest neighbour (ANN) indexes, a capability foreign to traditional databases.
No single database engine can be optimal for all of these workloads. The database industry has evolved specialised categories to address each one, and many modern architectures combine several of them.
Database Categories Overview​
| Database Type | Primary Data Model | Typical Use Cases | Example Technologies |
|---|---|---|---|
| Relational | Tables with rows, columns, and relationships | Transactions, ERP, CRM, e‑commerce | PostgreSQL, MySQL, Oracle Database |
| Document | JSON or BSON documents with flexible schemas | Content management, product catalogs, user profiles | MongoDB, Couchbase |
| Key‑Value | Simple key‑value pairs, often in‑memory | Caching, session management, rate limiting, leaderboards | Redis, Amazon DynamoDB |
| Graph | Nodes and edges representing entities and relationships | Social networks, recommendation engines, fraud detection, knowledge graphs | Neo4j, Amazon Neptune |
| Wide‑Column | Tables with flexible columns grouped into column families | Large‑scale event data, IoT, telemetry, big data | Apache Cassandra, Apache HBase |
| Time‑Series | Sequences of data points indexed by time | Monitoring, observability, IoT, financial market data | InfluxDB, TimescaleDB |
| Search | Inverted indexes for full‑text search | Website search, log analytics, security monitoring | Elasticsearch, OpenSearch |
| Analytical | Columnar storage for fast aggregations | Business intelligence, dashboards, data warehouses, reporting | ClickHouse, DuckDB, Snowflake, BigQuery |
| Vector | High‑dimensional vectors for similarity search | AI retrieval, semantic search, recommendation, image search | pgvector, Milvus, Pinecone, Qdrant, Weaviate |
Each category is explored in detail below.
Relational Databases​
Relational databases organise data into tables with predefined columns and rows. Every row is uniquely identified by a primary key, and relationships between tables are enforced through foreign keys and constraints. They use SQL as the standard query language and provide ACID transactions (Atomicity, Consistency, Isolation, Durability) to guarantee data correctness even under concurrent access and system failures.
Typical use cases:
- Banking and financial systems, where a transfer must debit one account and credit another atomically.
- E‑commerce platforms, where orders, customers, products, and payments are naturally related and require referential integrity.
- Enterprise Resource Planning (ERP) and Customer Relationship Management (CRM) systems with complex reporting needs.
Example technologies:
- PostgreSQL — open source, feature‑rich, extensible (supports JSON, full‑text search, and vector search via
pgvector). - MySQL — widely used in web applications, known for its speed and simplicity.
- Oracle Database — enterprise‑grade with advanced high‑availability and management tools.
- Microsoft SQL Server — tightly integrated with the Microsoft ecosystem.
Strengths:
- Strong consistency and data integrity guarantees.
- Standardised, powerful query language (SQL).
- Mature tooling for backup, migration, and monitoring.
- Excellent for complex joins and ad‑hoc queries.
Limitations:
- Schema changes require careful migrations.
- Horizontal scaling (sharding) adds significant operational complexity.
- Performance can degrade for workloads better suited to specialised data models (e.g., deep graph traversal, full‑text search).
Document Databases​
Document databases store data as self‑describing documents, typically in JSON or BSON format. Each document can have a different structure, allowing schemas to evolve without migrations. Nested objects and arrays are stored inline, which often matches how data is consumed by an application.
Typical use cases:
- Content management systems, where articles, pages, and metadata vary in structure.
- Product catalogs, where different product categories have different attributes.
- User profiles with optional fields that change frequently as features are added.
Example technologies:
- MongoDB — the most prominent document database, with a rich query language and aggregation pipeline.
- Couchbase — combines document storage with key‑value caching and SQL‑like querying.
Strengths:
- Flexible schema accelerates development and iteration.
- Documents map naturally to application objects, reducing impedance mismatch.
- Many support expressive queries and secondary indexes on document fields.
Limitations:
- Joins across collections are less efficient than in relational databases (often requiring denormalisation or application‑level logic).
- Multi‑document ACID transactions are available but historically not the default, and should be used with awareness of performance implications.
- Schema flexibility can lead to data inconsistency if not governed at the application level.
Key‑Value Databases​
Key‑value databases are the simplest database model: a map from a unique key to a value. The value is opaque to the database; it can be a string, JSON, binary object, or anything else. Simplicity enables extreme performance, often with data served directly from memory.
Typical use cases:
- Caching — storing the results of expensive database queries or API calls.
- Session management — mapping session tokens to user state.
- Rate limiting — counting requests per user per time window using atomic increment operations.
- Leaderboards and counters — using sorted sets or atomic counters.
Example technologies:
- Redis — in‑memory data store supporting strings, hashes, lists, sets, sorted sets, streams, and pub/sub.
- Amazon DynamoDB — fully managed key‑value and document database with automatic scaling.
Strengths:
- Extremely low latency (sub‑millisecond for in‑memory stores).
- Simple data model is easy to reason about.
- Often support advanced data structures beyond simple gets and sets.
Limitations:
- Limited querying capabilities beyond key‑based access.
- Data size is constrained by available memory (for in‑memory stores), though persistence options exist.
- Typically provide eventual consistency or configurable consistency, not full ACID by default.
Graph Databases​
Graph databases model entities as nodes and relationships as edges, both of which can have properties. They are designed for workloads where the connections between data points are as important as the data points themselves. Graph traversal algorithms (e.g., shortest path, neighbour queries) execute efficiently without the exponential join complexity that relational databases suffer in such scenarios.
Typical use cases:
- Social networks — "friends of friends who liked this post."
- Recommendation engines — "users who bought X also bought Y."
- Fraud detection — analysing transaction networks to find suspicious patterns.
- Knowledge graphs — representing and querying complex domain knowledge.
- Network topology and IT asset management.
Example technologies:
- Neo4j — leading graph database with the Cypher query language.
- Amazon Neptune — managed graph database supporting RDF and property graph models.
Strengths:
- Traversal queries that would require many SQL joins are expressed concisely and run faster.
- The model is intuitive for highly connected domains.
- ACID transactions are available in some graph databases (e.g., Neo4j).
Limitations:
- Less suitable for simple, non‑relational data or high‑throughput key‑value workloads.
- The query paradigm (graph traversal) has a steeper learning curve than SQL.
- Tooling and ecosystem are less mature compared to relational databases.
Wide‑Column Databases​
Wide‑column databases store data in tables with a twist: columns can vary per row, and they are grouped into column families that are stored together on disk. The design is optimised for distributed, write‑heavy workloads across many commodity servers.
Typical use cases:
- Large‑scale event logging — recording every click, view, or API call across a platform.
- Internet of Things (IoT) — ingesting sensor data from millions of devices.
- Telemetry and real‑time analytics — where write throughput and availability are critical.
Example technologies:
- Apache Cassandra — decentralised, masterless architecture designed for high availability and linear scalability.
- Apache HBase — modelled after Google’s Bigtable, often used in the Hadoop ecosystem.
Strengths:
- Excellent horizontal scalability and fault tolerance.
- High write throughput due to append‑only storage models.
- Tunable consistency levels allow trade‑offs between consistency and latency.
Limitations:
- Query patterns must be designed around the primary key; ad‑hoc queries are difficult.
- No joins; data is often denormalised heavily.
- Operational complexity can be significant; cluster maintenance requires expertise.
Time‑Series Databases​
Time‑series databases are optimised for storing and querying sequences of data points indexed by time. They handle high‑ingest rates (millions of writes per second) and provide built‑in functions for downsampling, retention policies, and continuous aggregation.
Typical use cases:
- Infrastructure monitoring — CPU usage, memory, disk I/O.
- Application performance monitoring (APM) — request latencies, error rates.
- IoT sensor data — temperature, humidity, vibration over time.
- Financial market data — stock prices, trade volumes.
Example technologies:
- InfluxDB — purpose‑built time‑series engine with a SQL‑like query language.
- TimescaleDB — a PostgreSQL extension that adds time‑series optimisations, combining relational features with time‑series performance.
Strengths:
- High write throughput and efficient time‑based compression.
- Built‑in time‑oriented functions (window aggregates, gap filling, downsampling).
- Automatic data retention and tiered storage management.
Limitations:
- Not designed for complex joins or transactional workloads.
- Query patterns that fall outside time‑based ranges can be inefficient.
- The specialised data model limits general‑purpose use.
Search Databases​
Search databases (search engines) are built around inverted indexes, which map every term to the documents that contain it. They enable full‑text search with typo tolerance, stemming, and relevance scoring, and they can also handle structured filters and aggregations.
Typical use cases:
- Website and product search — returning relevant results from millions of items.
- Log analytics — searching and aggregating application and infrastructure logs (e.g., ELK stack).
- Security information and event management (SIEM) — real‑time threat detection across logs.
Example technologies:
- Elasticsearch — distributed search engine built on Apache Lucene, with rich aggregation and visualisation capabilities.
- OpenSearch — open‑source fork of Elasticsearch, community‑driven.
Strengths:
- Sub‑second search over terabytes of unstructured text.
- Powerful relevance ranking and filtering.
- Horizontally scalable and fault‑tolerant.
Limitations:
- Not a primary source of truth; typically used as a secondary index for search.
- Strong consistency and ACID transactions are not the default model.
- Resource‑intensive; requires significant memory and disk for large clusters.
Analytical Databases​
Analytical databases (OLAP engines) use columnar storage and vectorised execution to dramatically accelerate aggregations over large datasets. Instead of storing all columns of a row together, each column is stored separately, allowing queries that scan millions of rows and aggregate a few columns to read only the necessary data.
Typical use cases:
- Business intelligence dashboards — revenue by region, month‑over‑month growth.
- Data warehousing — central repository for structured business data.
- Ad‑hoc analytics — answering complex business questions with low latency.
- Reporting — generating periodic reports from large datasets.
Example technologies:
- ClickHouse — open‑source column‑oriented DBMS designed for real‑time analytics.
- DuckDB — embeddable OLAP database optimised for analytical workloads on local data (like SQLite for analytics).
- Snowflake — cloud‑native data warehouse with separation of storage and compute.
- BigQuery — fully managed, serverless data warehouse on Google Cloud.
Strengths:
- Orders of magnitude faster than row‑oriented databases for aggregate queries.
- High compression ratios reduce storage costs.
- Some support standard SQL, making them accessible to analysts.
Limitations:
- Not suitable for transactional workloads with frequent updates and deletes.
- Data loading is typically batch‑oriented; real‑time row‑by‑row inserts are inefficient.
- Schema changes can be more rigid, depending on the engine.
Vector Databases​
Vector databases store high‑dimensional numerical vectors — embeddings — produced by machine learning models. They enable similarity search: finding vectors that are close in geometric space (using cosine similarity, Euclidean distance, etc.) using approximate nearest neighbour (ANN) algorithms. This capability is central to modern AI applications.
Typical use cases:
- Retrieval‑Augmented Generation (RAG) — retrieving relevant documents to ground a language model’s responses.
- AI assistants and chatbots — finding similar past conversations or knowledge base articles.
- Semantic search — searching by meaning rather than keywords.
- Recommendation systems — recommending products or content similar to what a user liked.
- Image and audio search — finding visually or acoustically similar items.
Example technologies:
- pgvector — PostgreSQL extension that adds vector storage and ANN indexes, allowing one database to handle both relational and vector workloads.
- Milvus — open‑source, cloud‑native vector database designed for billion‑scale similarity search.
- Pinecone, Qdrant, Weaviate — managed and self‑hosted vector databases with developer‑friendly APIs.
Strengths:
- Enables semantic understanding that keyword search cannot achieve.
- ANN algorithms provide fast results even over hundreds of millions of vectors.
- Often integrates cleanly with existing machine learning pipelines.
Limitations:
- Complements rather than replaces relational databases; does not handle transactions, joins, or structured constraints natively.
- ANN search returns approximate results, which may not be acceptable for all use cases.
- The field is evolving rapidly; best practices and standards are still maturing.
Comparing Database Types​
| Database Type | Structured Data | Flexible Schema | ACID Transactions | Horizontal Scaling | Full‑Text Search | AI / Vector Support | Best Use Cases |
|---|---|---|---|---|---|---|---|
| Relational | Strong | Weak (migrations needed) | Strong | Moderate (sharding is complex) | Limited | With extensions (e.g., pgvector) | Transactional systems, complex queries |
| Document | Weak | Strong | Limited per document | Strong | Limited | Emerging | Content management, catalogues |
| Key‑Value | Weak | Strong (value is opaque) | None or limited | Strong | None | Not applicable | Caching, sessions, fast lookups |
| Graph | Moderate | Moderate | Varies (Neo4j has ACID) | Moderate | Limited | Not applicable | Social networks, recommendations |
| Wide‑Column | Moderate | Flexible columns | Limited (per row) | Excellent | Limited | Not applicable | Event data, IoT, telemetry |
| Time‑Series | Moderate | Moderate | Limited | Strong | None | Not applicable | Metrics, monitoring, sensor data |
| Search | Weak (text‑centric) | High for documents | None (eventual) | Excellent | Excellent | Limited (dense vectors supported) | Full‑text search, log analytics |
| Analytical | Strong | Weak (schema‑on‑write) | None (read‑optimised) | Strong | Limited | Not applicable | BI, dashboards, data warehousing |
| Vector | None (vectors + metadata) | Flexible for metadata | None | Strong | Semantic via vectors | Core capability | AI retrieval, semantic search |
Choosing the Right Database​
Instead of starting with "which database should I use?", start with your workload requirements. Ask the following questions to narrow the field:
Is the data highly structured, with clear relationships and a need for referential integrity? → Relational database (PostgreSQL, MySQL).
Are ACID transactions across multiple records critical for correctness? → Relational database, or a document database that offers multi-document transactions if the data model is document-oriented.
Do you need to cache frequently accessed data to reduce latency and database load? → Key-value store (Redis).
Is full‑text search with relevance ranking a core feature? → Search database (Elasticsearch, OpenSearch) in addition to a primary store.
Does the application revolve around relationships and deep traversals (friend‑of‑friend, recommendation networks)? → Graph database (Neo4j).
Are you ingesting massive streams of time‑stamped data and need efficient time‑based queries? → Time‑series database (InfluxDB, TimescaleDB).
Is the workload analytical — large scans, aggregations, dashboards — on relatively static data? → Analytical database (ClickHouse, DuckDB, Snowflake).
Does the application require semantic search, similarity matching, or AI retrieval of embeddings? → Vector database (pgvector, Milvus, Pinecone), likely alongside a relational store.
Rarely will a single question determine the entire architecture. Most production systems answer "yes" to multiple questions, which leads to polyglot persistence.
Modern Database Architectures​
A modern web application often combines multiple database types, each handling the workload it was designed for. This approach is called polyglot persistence.
Example: E‑commerce Platform
Web Application
|
---------------------------------------------------------
| PostgreSQL | Redis | Elasticsearch |
| (orders, | (session, | (product search) |
| inventory) | cache) | |
---------------------------------------------------------
|
Vector Database (pgvector)
(semantic product recommendations)
- PostgreSQL is the source of truth for transactional data: orders, payments, and inventory, where ACID is non‑negotiable.
- Redis caches user sessions and product list pages, keeping latency low under high traffic.
- Elasticsearch indexes product names, descriptions, and categories to provide fast, tolerant full‑text search.
- pgvector (PostgreSQL extension) stores product embeddings and performs similarity search for “visually similar” or “others also bought” recommendations, avoiding a separate vector database if the scale permits.
Example: AI‑Powered Application
Application Layer
|
---------------------------------------------------------
| PostgreSQL | Redis | Object Storage (S3) |
| (user accounts,| (rate | (documents, models) |
| billing) | limiting) | |
---------------------------------------------------------
|
Vector Database (Milvus / pgvector)
(knowledge base embeddings, RAG retrieval)
- PostgreSQL handles user authentication, billing, and structured metadata.
- Redis implements rate limiting on the AI endpoint to control costs.
- Object storage holds raw PDFs, HTML pages, and model artifacts.
- The vector database stores chunk embeddings and retrieves relevant context for each user query (RAG).
The key principle: each database solves a specific problem, and the system as a whole remains manageable only if every technology in the stack earns its place.
Common Mistakes​
Trying to Use One Database for Everything​
A relational database can handle search, caching, and analytics to a point, but pushing it beyond its sweet spot leads to complex workarounds, poor performance, and fragile schemas. Recognise when a workload has outgrown the current database and would benefit from a specialised store.
Choosing a Database Based on Popularity​
MongoDB is an excellent document database, but if your data is highly relational and requires frequent joins, it is the wrong tool. Elasticsearch is powerful, but it is not designed to be a primary source of truth. Always map technology to workload, not the other way around.
Ignoring Operational Complexity​
Adding a new database means adding a new system to monitor, back up, patch, and scale. A polyglot architecture can quickly become unmanageable if each new database is added without a clear operational plan. Justify every addition with concrete, measurable benefits.
Using NoSQL Without Understanding Relational Modeling​
Flexible schemas can lead to data chaos if developers lack a grounding in data modeling principles. Understanding normalisation, keys, and relationships in the relational world makes you a far more effective NoSQL user.
Best Practices​
- Learn SQL and relational modelling first. They form the foundation of data engineering and are transferable across almost every other database type.
- Understand database categories, not just products. PostgreSQL, MySQL, and Oracle are all relational; Redis and Memcached are both key‑value stores. Grasp the category concepts, and the specific products become easy to learn.
- Match databases to workload requirements. Let the data model, query patterns, consistency needs, and scale dictate the choice.
- Keep architectures as simple as possible. Start with a single, well‑tuned relational database. Introduce additional database types only when a clear, measured need arises.
- Design for polyglot persistence carefully. Document the responsibilities of each data store and how they interact. Ensure the team has the operational capacity to manage the resulting system.
Recommended Reading​
- What Is a Database? A Practical Introduction — The starting point for understanding databases and their role in applications.
- SQL vs NoSQL Explained — A deeper comparison of the two broad paradigms that underlie many of the categories discussed here.
- Database Learning Roadmap for Developers — A structured roadmap to build database engineering skills from scratch.
- PostgreSQL vs MySQL — Detailed architectural comparison of the two dominant relational databases.
- Redis Explained — How Redis works and the patterns it enables for caching, messaging, and real‑time data.
- Vector Databases Explained — A comprehensive introduction to vector databases and their role in AI systems.
- Database Architecture Fundamentals — How these database types are assembled into scalable, resilient architectures.
Key Takeaways​
- Databases are specialised into categories (relational, document, key‑value, graph, wide‑column, time‑series, search, analytical, vector), each optimised for specific data models and workloads.
- Relational databases remain the default for transactional systems with structured data, while NoSQL categories address specific limitations of the relational model.
- Modern applications frequently use polyglot persistence — combining multiple database types — to handle diverse requirements within a single system.
- Choosing a database should always begin with workload analysis: data structure, query patterns, consistency needs, and scalability requirements.
- Understanding database categories is more durable than memorising specific products; the category concepts transfer across tools and decades.
Frequently Asked Questions​
Which database should beginners learn first?​
Start with a relational database like PostgreSQL or MySQL. They teach structured thinking, data modeling, and SQL — skills that apply across the entire database landscape. Once comfortable, exploring a document database (MongoDB) and a key‑value store (Redis) broadens your perspective.
Is PostgreSQL still the best general‑purpose database?​
PostgreSQL is an excellent general‑purpose database because it combines strong relational features with JSON support, full‑text search, and extensions like pgvector for vector search. It is a safe default for many projects, but other databases may be better fits for specialised workloads (e.g., Elasticsearch for large‑scale full‑text search).
Is Redis a database or a cache?​
Redis is a data structure server that can be used as a cache, a database, or a message broker. Many deployments use it primarily as a cache because of its in‑memory speed, but it also supports persistence, replication, and data structures that make it suitable as a primary database for certain use cases (e.g., real‑time leaderboards).
Does every application need NoSQL?​
No. Many applications work perfectly well with a single relational database. NoSQL databases solve specific problems; you should introduce them only when your workload requires their particular strengths (flexible schema, horizontal scale, specialised data model) and the additional complexity is justified.
Are vector databases only for AI?​
Today, vector databases are predominantly used in AI contexts — semantic search, RAG, recommendations — because embeddings are the primary data type. However, any application that needs similarity search (e.g., duplicate detection, visual similarity) can benefit from a vector database, even without a full AI pipeline.
Can one application use multiple database types?​
Yes. This is called polyglot persistence and is very common. A typical setup might be PostgreSQL for transactions, Redis for caching, and Elasticsearch for search. The key is to have a clear justification for each database and to manage the operational complexity consciously.
What's Next?​
Now that you have a broad understanding of the database types landscape, the next step is to plan your learning journey and dive into the specifics of each category.
Continue with these articles:
- Database Learning Roadmap for Developers — A curated, step‑by‑step roadmap through all the essential database topics.
- Database Foundations — Deepen your knowledge of relational database internals, which underpin many of the concepts discussed here.
- Modern Databases — Explore individual database technologies in detail, from PostgreSQL and MongoDB to Redis and Neo4j.
- Database Architecture — Learn how to combine these database types into resilient, scalable systems.
Understanding database categories is a foundational skill for making sound technology and architecture decisions throughout your software engineering career.