What is a Storage Engine
A storage engine is the component inside a database that handles reading and writing data on disk. When you run an INSERT, the storage engine decides where to put the bytes. When you run a SELECT, it decides how to retrieve them. Everything above the storage engine — the SQL parser, the query planner, the connection handler — depends on it.
How it works
A storage engine manages three things: on-disk layout, in-memory caching, and durability.
The on-disk layout determines how rows or documents are physically stored. B-tree engines (InnoDB, SQLite) store data in sorted pages that allow efficient point lookups and range scans. LSM-tree engines (RocksDB, LevelDB) write data sequentially to sorted files and merge them in the background, optimizing for write throughput at the cost of read amplification.
The in-memory cache (called the buffer pool in InnoDB) keeps frequently accessed pages in RAM. A well-tuned buffer pool means most reads never hit disk. Cache misses trigger disk I/O — the slowest operation in the entire system.
For durability, the engine uses a write-ahead log. Changes are written to the log before they are applied to data files. If the database crashes, the WAL is replayed to recover committed transactions.
Most databases let you choose or swap storage engines. MySQL supports InnoDB (default, ACID-compliant) and MyISAM (legacy, no transactions). MongoDB switched from MMAPv1 to WiredTiger. SQLite has a single built-in engine.
Why it matters
The storage engine determines your database's performance characteristics. B-tree engines favor read-heavy workloads with point lookups. LSM-tree engines favor write-heavy workloads with sequential writes. Choosing the wrong engine for your workload means leaving performance on the table — or worse, hitting I/O bottlenecks under load.
See How Storage Engines Work for the full comparison of B-tree and LSM-tree architectures.