Outt-the-box, WordPress is extremely efficient.
However, this can change as a site grows and more and more entries are added to the database.
In the last quarter of 2021, we came across a thread on a popular web hosting forum - Web Hosting Talk - where a user was asking for assistance in troubleshooting high MySQL usage from their WordPress installation. Further investigation revealed that there were a lot of SELECT queries on their WordPress wp_postmeta table.
The user received advise to create an index:
Indexes are used to find rows with specific column values quickly. Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs. If the table has an index for the columns in question, MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. This is much faster than reading every row sequentially.
They did so, and in their own words:
after creating indexes on wp_postmeta, load has been drastically reduced
Quite clearly, that's fabulous news! Their WordPress database was made more efficient by creating an index, reducing the strain on the MySQL service, and helping to improve performance. Who wouldn't want that?
With that said, not all webmasters are going to want the hassle of doing a job like this manually, as some basic knowledge of tools such as phpMyAdmin are required.
Fear not, we've come across an excellent WordPress plugin that creates indexes not just on the wp_postmeta table, but other tables that are susceptible to similar problems, including:
It has other helpful, performance-boosting functionality, too:
If your tables use MyISAM (the older storage engine) or the older COMPACT row format, this plugin offers to upgrade them for you [to InnoDB].
The plugin in question can be found at https://wordpress.org/plugins/index-wp-mysql-for-speed/
This plugin is completely safe to use, any its changes can be reverted at any time, with ease, if needed.
If you'd like assistance installing Index MySQL For Speed on your WordPress website, please feel free to get in touch!
Tuesday, April 26, 2022