Add MySQL Index to WordPress Tables

A great example where an index may be a good option is the wp-options table, it can become bloated due to settings placed there by themes and plugins. This is because many plugins and theme builders store large amounts of transient or session data in the options table. If you’d like to speed up the WP-Admin side of your website as well as the front-end you definitely want to start optimising how you store and access the database. One way is using object caches such as Memcached or Redis services to store the data in RAM for fast access. The other option is adding an index to the wp_options table so that finding the relevant options takes far less time. It’s akin to adding a index to a book, it makes queries more efficient.


First off read How you can connect to WordPress MySQL databases.

The basics are, connect via SSH then type the following command:

MYSQL -u databaseusername -p database_name

replacing the fields as necessary, a quick way to find them is using viewing the config file by typing vim wp-config.php


Leave a comment