For the complete documentation index, see llms.txt. This page is also available as Markdown.

Statistics for Optimizing Queries

Utilize statistics to optimize queries in MariaDB Server. This section explains how the database uses statistical information to generate efficient query execution plans and improve performance.

Engine-independent table statistics store optimizer statistics in mysql database tables, collected via ANALYZE TABLE and controlled by the use_stat_tables variable.

Histogram-based statistics give the optimizer value-distribution data for indexed and non-indexed columns, improving query plans through better selectivity estimates.

InnoDB persistent statistics store index and table statistics on disk so they survive server restarts, controlled by innodb_stats_persistent and related variables.

Extends the slow query log with query-plan, EXPLAIN, and storage-engine statistics, controlled by log_slow_verbosity, log_slow_filter, and log_slow_rate_limit.

The userstat plugin adds USER, CLIENT, INDEX, and TABLE statistics as INFORMATION_SCHEMA tables plus SHOW and FLUSH statements to track server activity and load.

Last updated

Was this helpful?