What is the InnoDB engine

· Category: SQL & Databases

Short answer

InnoDB is the default MySQL storage engine. It provides ACID transactions, row-level locking, foreign key support, and crash recovery through the redo log.

How it works

InnoDB stores data in clustered indexes organized by primary key. Changes are first written to the in-memory buffer pool and the redo log, then flushed to disk asynchronously. This design ensures durability while maintaining high performance.

Example

CREATE TABLE accounts (id INT PRIMARY KEY, balance DECIMAL(10,2)) ENGINE=InnoDB;
BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
COMMIT;

Why it matters

InnoDB is suitable for nearly all workloads that require reliability and concurrency. Its MVCC implementation allows consistent reads without locking, improving throughput under load.r