Database Internals and Storage Engines Questions

How a single database engine works internally, at the mechanism level: storage-engine architectures such as B-tree versus LSM-tree, on-disk page and buffer-pool management, write-ahead logging (WAL) and checkpointing, and MVCC's internal mechanics (version chains, vacuum and bloat, transaction-ID wraparound). Also covers compaction and its write/read amplification trade-offs, including engine-specific behavior such as Bloom filters and tombstone/TTL expiry in LSM-based stores like Cassandra, and hands-on design of simplified storage components: on-disk data layouts and indexes, WAL recovery routines, compaction strategies, and crash-safe log or queue formats. Tests depth beyond usage: why the engine behaves as it does, not how to operate, tune, recover, or scale it.

HardSystem Design
51 practiced

You are asked to design a simple transactional storage engine prototype that supports ACID guarantees: describe the high-level architecture, core data structures (indexes, append-only log, memtable/sstable or pages), transaction logging (WAL), concurrency control approach (locking vs MVCC), checkpointing and background compaction, and crash recovery algorithm. Focus on the trade-offs for durability, latency, and throughput.

HardTechnical
43 practiced

Implement a simplified write-ahead log recovery routine in Python. Input: a list of log entries representing transactions with operations (BEGIN, SET key value, DELETE key, COMMIT, ABORT). The recovery routine should apply REDO for committed transactions and skip or UNDO uncommitted ones to rebuild final key-value state. Provide function(s) and ensure idempotence if the recovery runs twice. Show sample input and expected output.

EasyTechnical
44 practiced

Explain the difference between B-tree and LSM-tree indexing structures, for example as used in PostgreSQL versus RocksDB. For a high-ingest logging service, which index type would you typically choose, and why?

HardTechnical
50 practiced

Implement a disk-backed, time-partitioned index for streaming events that supports append(event) and range_query(start_ts, end_ts), staying under a fixed memory budget. Use segment files for compact on-disk storage optimized for append speed, and include a periodic compaction step that merges segments. Explain your on-disk serialization strategy and how a range query locates the relevant segments without scanning the whole store.

HardSystem Design
63 practiced

You're designing the compaction strategy for an LSM-based store (e.g., RocksDB) that must balance write throughput, read latency, and disk usage for a mixed workload. What compaction approaches would you consider and how would you choose between them, how would you throttle compaction under peak load, and what would you monitor to make sure compaction doesn't destabilize the service?

Unlock Full Question Bank

Get access to all 22 Database Internals and Storage Engines interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.