Data and Databases

Other Types of Databases


Learning Objectives

  • You can describe, at a high level, how key-value, document, wide-column, graph, time-series, and vector databases differ from relational databases.

Relational databases are extremely common, but they are not the only way to store persistent data. Some alternatives are broad storage families, while others are more specialized around a certain data shape or query pattern.

In this chapter, we briefly survey a few of these other database families. The sketches below are intentionally simplified. Their goal is not to show the full implementation details of each database family, but to make the stored data shape easier to notice at a glance.

Although we visit other types of databases here, the main focus of the course is relational databases. The relational model provides a strong foundation for learning data structure, querying, and design, even though some workloads are better served by more specialized systems.

Key-Value Databases

A key-value database stores values behind keys.

Figure 1 — A key-value store is easiest to picture as direct lookup from one key to one stored value.

This is a good fit when the application mostly needs simple lookup by identifier. For example, a course platform might store a session token or a temporary cache entry under one key and retrieve it quickly later.

Typical questions might be:

  • What session token is stored for user 42?
  • What cached page is stored for course CS-A1150?

One commonly used example of a key-value database is Redis.

Loading Exercise...

Document Databases

A document database stores structured documents, often in JSON-like form.

Figure 2 — A document database often stores one nested record as one document instead of spreading the same information across many tables.

This can be convenient when records naturally look like nested documents and when the structure may vary somewhat from one document to another. For example, rich exercise descriptions with optional metadata, rubric details, and attachments might be easier to represent as documents than as a large number of relational columns.

Typical questions might be:

  • What does the full exercise document for Query Basics look like?
  • Which attachments are stored inside this exercise document?

One commonly used example of a document database is MongoDB.

Loading Exercise...

Wide-Column Databases

A wide-column database groups data by a row key and allows rows to contain a large number of columns, often with somewhat sparse structure.

Row keyactivity:2026-03-01activity:2026-03-02activity:2026-03-10
user:42viewedsubmitted
user:77loginviewed
Figure 3 — A wide-column sketch highlights grouping by row key and the fact that different rows may have different columns present.

This can be useful when the system needs to store very large amounts of data under keys such as user, device, or tenant, and when fast access by that key matters more than rich relational joins. For example, an educational platform might keep a very large history of activity events grouped by user or course instance.

Typical questions might be:

  • What activity events do we have for user 42?
  • What activity records are stored under this course-instance key?

One commonly used example of a wide-column database is Apache Cassandra.

Loading Exercise...

Graph Databases

A graph database emphasizes nodes and connections between them.

Figure 4 — A graph database stores nodes and links directly, which makes relationship-heavy data easier to picture.

This is useful when relationships are the central feature of the data, for example in social networks, recommendation systems, or route planning. In an educational setting, a graph could represent prerequisite relationships between topics or courses.

Typical questions might be:

  • Which topics are prerequisites for this course?
  • What courses become reachable after completing Databases?

One commonly used example of a graph database is Neo4j.

Loading Exercise...

Time-Series Databases

A time-series database is designed for data points that are primarily organized by time.

Timesubmission_count
10:0012
10:1518
10:3031
10:4520
Figure 5 — A time-series database is easiest to picture as timestamped values ordered by time.

This is useful when the system stores measurements, logs, or events and later needs to ask questions such as what happened over a certain time window or how values changed over time. Examples include server metrics, sensor readings, application response times, or submission activity counts across days.

Typical questions might be:

  • How many submissions arrived each hour today?
  • How did server response time change during the last 15 minutes?

One commonly used example of a time-series database is InfluxDB.

Loading Exercise...

Vector Databases

A vector database is designed for storing vectors and searching for items that are similar to one another in meaning or content.

y
^
|                    help_article_B
|               help_article_A
|          course_description
|
|  cache_token
+----------------------------------> x
Figure 6 — A vector database stores items as points in a high-dimensional space; this 2D sketch only illustrates the idea that similar items sit close together.

This is useful when the system needs similarity search rather than exact matching. For example, a learning system might want to find course descriptions, feedback comments, or help articles that are most similar to a student’s question after those texts have been turned into vector embeddings.

Typical questions might be:

  • Which help articles are most similar to this student’s question?
  • Which course descriptions are semantically closest to this topic?

One commonly used example of a vector database is Pinecone.

Loading Exercise...

Check Your Understanding

  1. When might a key-value store be simpler than a relational schema?
  2. What kind of problem can make a document or wide-column database attractive?
  3. Why can graph databases be attractive for relationship-heavy problems?
  4. Why can time-series and vector databases each be useful for their own kind of query?

AI Study Aid

Create a chapter diagram

We're looking into to what extent AI-generated diagrams could help with studying.

Use this study aid to generate an AI-generated visual summary of the material you just studied. Each diagram style emphasizes the content in a different way, so you can choose the focus that feels most useful.

Using the diagram generator is voluntary and does not affect your course progress. We encourage you to try it out and see if it helps, but it's totally up to you! Your answers help us understand how to make better study aids in the future.

Diagrams tried: 0

Selected style: choose a diagram style