mariadb-core-architecture
Installation
SKILL.md
MariaDB Core Architecture
How mysqld accepts a connection, parses a query, picks a plan, and reads pages from disk. Read this skill before tuning, before diagnosing slow queries, and before assuming MySQL behavior applies to MariaDB.
Quick Reference
- MariaDB = single multi-threaded
mysqldprocess with per-connection threads or a built-in thread-pool plug-in. - Query pipeline : parser (lex + yacc) : optimizer (cost-based,
optimizer_switchflags) : executor : storage-engine handler API. - Storage engines are plug-ins ; choice happens at
CREATE TABLE ... ENGINE=time. InnoDB is the default ; Aria, MyISAM, MEMORY, MyRocks, Spider, S3, Archive, CSV, Sequence, MERGE are pluggable. - In-memory caches per engine ; biggest is the InnoDB buffer pool, sized 60-80% of RAM on a dedicated DB host.
- Diverges from MySQL : different
optimizer_switchflags (e.g.condition_pushdown_for_subquery,rowid_filter,split_materialized), built-in thread-pool (not Enterprise-only), query cache kept (deprecated, off by default), GTID format incompatible, JSON is LONGTEXT alias. - ALWAYS run
EXPLAINbefore tuning : optimizer choices are visible in the plan, not in the schema. - NEVER set
innodb_buffer_pool_sizeblindly to 50% RAM on a dedicated DB host. Target 60-80%. - NEVER enable every flag in
optimizer_switch. Several are OFF by default (e.g.mrr,mrr_cost_based,index_merge_sort_intersection) because the cost model rejects them in common cases.
Process Model
mysqld is a single OS process with these thread roles :