Skip to content
engineering workbench.by StudyPort Academy
Learning path
Intermediate18 min

Specialized Stores: Time-Series and Graph Databases

Understand the idea

When to adopt time-series or graph databases, and when to resist architectural sprawl.

The idea

Beyond relational, document, and vector databases, two other specialized database types solve specific engineering problems:

  1. Time-Series Databases (e.g. TimescaleDB, InfluxDB): Built for streams of timestamped numbers (server metrics, weather sensor readings, financial stock ticks). They organize data by time chunks, compress old history by up to 90%, and quickly calculate rolling averages over minutes, hours, or days.
  2. Graph Databases (e.g. Neo4j, Amazon Neptune): Built for datasets where the connections between items matter just as much as the items themselves. Each entity points directly to connected entities in memory. Finding friends-of-friends, mapping fraud networks, or checking user permissions takes milliseconds instead of requiring slow recursive .

A key lesson for engineers is to avoid tool clutter: every extra database you add means another system to back up, monitor, and maintain. Use PostgreSQL for your main data, use a like Redis for caching, and only add specialized databases when your data volume genuinely demands it.

What changes

Time-Series vs Graph vs Relational
AttributeTime-Series (TimescaleDB / InfluxDB)Graph (Neo4j)Relational (PostgreSQL)
Primary Data ShapeAppend-only timestamp + measurement metricNodes (entities) and directed Edges (relations)Structured tabular rows and foreign keys
Key OptimizationHigh write ingestion + time-based compressionPointer-chasing multi-hop edge traversalBalanced general-purpose queries and ACID safety
Best WorkloadServer metrics, IoT telemetry, stock tradesSocial networks, fraud rings, dependency treesStandard web applications, e-commerce, SaaS

The command

Graph traversal: 2nd-degree friend connections

3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

The mistake

Check the result

Run the example to see graph traversal compute second-degree friends across connected nodes without issuing multi-table joins.

Guided challenge

Identify time-series workloads

Update the function so it returns true when isAppendOnlyTimestamped is true, and false when false.

Identify time-series workloads

3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

EXPECTED RESULT

true
false

Hints 0/1

    Use all hints or make 3 failed checks (0/3).

    Free exploration

    Change this example and run it again. Each run is a new process. Nothing is saved.

    Your variation

    3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.

    Quiz

    A quick check for understanding. Retry as often as you like; your learning path stays open.

    01What primary optimization do time-series databases (like TimescaleDB) provide for sensor data?
    02Why are graph databases faster than relational databases for deep relationship traversals?

    Ready to call this one understood?

    Mark this lesson complete to earn 150 XP. You can always revisit it.

    Sign in to save progress
    Next lesson