How To Optimize A Table In MySQL Or MariaDB

$ mysqlcheck -u root -p -o dbname

In MariaDB you will see:

note : Table does not support optimize, doing recreate + analyze instead
status : OK

information for the result above is below. Basically, InnoDB (the storage engine used my MariaDB) is doing a different set of tasks to accomplish the same thing as MyISAM.

Setting the query_cache_type

setting the query_cache_type to 1 (per mysqltuner recommendations):

$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

change the query_cache_type to 1 in the [mysqld] section so it looks like this:

query_cache_type        = 1
query_cache_limit       = 1M
query_cache_size        = 16M

restart mysqld

/etc/init.d/mysql restart


in the my.cnf file (/etc/mysql/my.cnf), disable Performance Schema by putting this under the [mysqld] section configuration:

performance_schema = off

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.