{}DSA Atlas

Storage Engines, Analytics & Time-Series

Row vs column storage, OLTP vs OLAP, data warehouses, lakes and lakehouses, star schemas, ETL/ELT and CDC, time-series storage (partitioning, compression, downsampling, retention, high cardinality), object storage, and backups/PITR.

Intermediate → Advanced6 interview questions

Row vs column storage

Row store (OLTP) 1 | Asha | Pune | 499 | 2026-10-01 2 | Ravi | Delhi | 129 | 2026-10-02 3 | Meera| Pune | 899 | 2026-10-02 whole row together: fast "get order 2" Column store (OLAP) id: 1, 2, 3 name: Asha, Ravi, Meera city: Pune, Delhi, Pune amount: 499, 129, 899 date: 10-01, 10-02, 10-02 SUM(amount) GROUP BY city reads only the green columns, and similar values compress extremely well
Same data, different physical layout, opposite strengths.
Row storeColumn store
Layoutall columns of a row togethereach column stored separately
Best querypoint lookups, whole-row reads, frequent updatesscans + aggregates over few columns
Compressionmoderateexcellent (RLE, dictionary, delta)
Writescheap single-rowbatch-friendly; single-row updates costly
ExamplesPostgres, MySQL, OracleClickHouse, Snowflake, BigQuery, Redshift, DuckDB, Parquet files

OLTP vs OLAP

OLTPOLAP
Usersthe applicationanalysts, dashboards, ML
Query shapeshort, by key, few rowslong scans, aggregates, many rows
Concurrencythousands of small transactionstens of heavy queries
Schemanormalised (3NF)denormalised (star/snowflake)
Data freshnessreal timeminutes to hours (or streaming)
SizeGB–TBTB–PB

HTAP systems (TiDB with TiFlash, SingleStore, AlloyDB columnar engine) try to serve both from one system using row + column replicas.

Warehouses, lakes and lakehouses

Data warehouseData lakeLakehouse
Storagemanaged columnarfiles on object storageopen files + table format
Schemaon writeon readenforced, evolvable
ACIDyesnoyes (Iceberg/Delta/Hudi)
WorkloadsBI/SQLdata science, raw retentionboth
ExamplesSnowflake, BigQuery, RedshiftS3 + ParquetIceberg on S3 + Trino/Spark/Snowflake

Star schema

fact_salesdate_key, product_key,store_key, qty, revenue dim_date dim_product dim_store dim_customer
Facts are numeric events; dimensions describe them. Queries filter on dimensions and aggregate facts.
  • Fact tables: events/measurements (sales, clicks) — long and narrow.
  • Dimension tables: descriptive attributes (product category, store region) — short and wide.
  • Slowly changing dimensions: Type 1 overwrite; Type 2 add a new row with validity dates to keep history.

Moving data: ETL, ELT, CDC, streaming

Postgres WAL / logicaldecoding Debezium Kafka warehouse search index cache / services
Change data capture turns the database log into a stream that keeps derived stores in sync.

Time-series storage

Characteristics

  • Very high append rate, rare updates.
  • Queries over time ranges, usually recent, with aggregations and grouping by tags.
  • Data loses value with age → downsample and expire.
  • Many series: a series = metric name + a unique set of label/tag values.

Techniques

TechniqueWhat it does
Time partitioning (chunks/shards per hour/day)recent chunk in memory; cheap retention (drop chunk)
Columnar compressiondelta-of-delta timestamps, Gorilla XOR floats → ~1.4 bytes/point in Prometheus-style engines
Downsampling / rollups10 s raw → 1 min → 1 h aggregates (min, max, avg, count, sum)
Retention policiesraw 15 days, 1-min rollups 90 days, hourly 2 years
Continuous aggregatesincrementally maintained materialised views
Inverted index on labelslabel → series IDs for fast filtering
Write bufferingWAL + in-memory head block, flushed as immutable blocks
SQL
-- TimescaleDB
CREATE TABLE cpu (ts TIMESTAMPTZ NOT NULL, host TEXT, usage DOUBLE PRECISION);
SELECT create_hypertable('cpu', 'ts', chunk_time_interval => INTERVAL '1 day');
ALTER TABLE cpu SET (timescaledb.compress, timescaledb.compress_segmentby = 'host');
SELECT add_compression_policy('cpu', INTERVAL '7 days');
SELECT add_retention_policy('cpu', INTERVAL '90 days');

CREATE MATERIALIZED VIEW cpu_hourly WITH (timescaledb.continuous) AS
SELECT time_bucket('1 hour', ts) AS bucket, host, avg(usage), max(usage)
FROM cpu GROUP BY bucket, host;

Choosing a time-series store

NeedOption
Infra/app metrics, alertingPrometheus (+ Thanos/Mimir/VictoriaMetrics for HA and long-term)
SQL + joins with relational dataTimescaleDB (Postgres extension)
Huge event analytics, logsClickHouse, Apache Druid, Apache Pinot
IoT ingestionInfluxDB, TimescaleDB, QuestDB
Financial tick datakdb+, QuestDB, ClickHouse

Object (blob) storage

S3, GCS, Azure Blob: flat namespace of keys → immutable objects, virtually unlimited, 11 nines of durability, cheap, high throughput, higher latency (tens of ms). Store images, videos, backups, data-lake files there; keep metadata (owner, size, key, checksum) in a database. Upload directly from clients with pre-signed URLs, serve through a CDN, use lifecycle rules to move to colder tiers. Since 2020, S3 provides strong read-after-write consistency for all operations.

Backups and recovery

ConceptMeaning
RPOmaximum acceptable data loss (time)
RTOmaximum acceptable downtime
Full / incremental / differential backuptrade backup time vs restore time
PITRbase backup + archived WAL → restore to any moment
3-2-1 rule3 copies, 2 media types, 1 off-site (plus 1 immutable/offline)

Replication is not a backup: a DROP TABLE replicates in milliseconds.

Interview questions

0 / 6 marked confident

Answer out loud first, then open the model answer. Mark a question confident only when you could explain it to an interviewer without notes.