MariaDB includes a facility to gather statistics on all tables, no matter what storage engine those tables use. The MariaDB optimizer can use these statistics to better calculate the optimum query plans.
Connect to MariaDB using the
mysql
command-line client with a user that has theSUPER
privilege.Run the following command:
SET GLOBAL use_stat_tables=complementary;
Force an update of the table statistics for a table with the following command (change
table_name
to the name of an existing table):ANALYZE TABLE table_name;
View the collected table, index, and column statistics with the following commands:
SELECT * FROM mysql.table_stats; SELECT * FROM mysql.index_stats; SELECT * FROM mysql.column_stats;