MariaDB
The community fork of MySQL: pluggable engines, MVCC InnoDB, and columnar storage for analytics.
MariaDB is a binary-compatible fork of MySQL that retains the MySQL client protocol and SQL dialect while replacing the storage engine layer with a more permissive set: InnoDB (default, MVCC), Aria (crash-safe MyISAM), ColumnStore (columnar, distributed), and Spider (sharding). The optimizer and parser are extended versions of MySQL’s.
InnoDB MVCC
InnoDB keeps up to 128 rollback segments of undo logs. Each row has a 6-byte transaction ID and a 7-byte roll pointer; old versions are read by following the chain.
Pluggable engines
A query plan can be served by any engine for any table. A single SELECT can join an InnoDB table to a ColumnStore table to a Spider-sharded remote table.
Galera cluster
A certification-based replication plugin that gives multi-master synchronous replication with conflict detection and zero data loss.
Optimistic row-level locking
Next-key locks and gap locks under REPEATABLE READ prevent phantoms; READ COMMITTED skips gap locks for higher throughput.
How InnoDB stores rows
A row in InnoDB lives on a 16 KiB page inside a tablespace (usually one file per table, configurable). Each row carries a 6-byte DB_TRX_ID and a 7-byte DB_ROLL_PTR. The roll pointer is the address of the undo log record that can reconstruct the previous version.
When a transaction updates a row, InnoDB writes a new row version in the clustered-index B-tree (which is the table) and inserts an undo record. Other transactions that started before the commit read the undo chain to find the version visible at their snapshot.
The query path
MariaDB ships a cost-based optimizer borrowed and extended from MySQL. SQL enters the parser, becomes a parse tree, then a resolved query block, then a plan. The optimizer applies join reordering, subquery unnesting, and condition pushdown before handing the plan to the executor.
The executor pulls rows through a Volcano-style iterator API. The same operator interface serves every storage engine, which is what makes the pluggable-engine model work.
CREATE TABLE events (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
payload JSON,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
INDEX (created_at)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
ColumnStore for analytics
ColumnStore is a separate engine that stores each column in its own file and skips irrelevant columns at read time. It runs across multiple servers and is the MariaDB answer to ClickHouse / Snowflake. You load data into a ColumnStore table, query it with the same SQL, and get column-pruned scans served by parallel workers.
Diagrams
Each 16 KiB InnoDB page carries a FIL header, page directory slot array, infimum/supremum records, and user records with transaction IDs.
Log writes append to ib_logfile0/1; the log buffer flushes on commit. Crash recovery replays the redo log from the last checkpoint.
MariaDB uses a pluggable storage engine layer; reads go through the optimizer into InnoDB, which serves pages from the buffer pool.
Writes append to the redo log, then to the doublewrite buffer, then to the tablespace file. Crash recovery restores dirty pages from the doublewrite.
InnoDB keeps undo chains; each transaction walks them to find the version visible at its snapshot.
A primary streams binary logs to multiple replicas; Galera can extend this to multi-master.