This WordPress database optimisation technique is useful in general, but especially so if your website runs the popular WooCommerce shopping cart plugin. In just 2 steps, your pages will load at least 2 seconds faster, but often a lot more than that.
One of my clients owns a site that sells dresses and despite being hosted on a business-grade server and using various caching and minification techniques, the product pages we often slow to load. Often, the WordPress back-end (admin area) was also slow. Since page loading speed is a big factor in conversion rate optimisation, as well as search engine optimisation, this was important to sort out.
To find out what was going on, I first installed the Query Monitor plugin, which shows various issues in the PHP proccessing of the page, including slow queries. On every page load, it was showing one particular query as taking at least 2 seconds, often longer. That query was run by a core function to load all the options with “autoload = ‘yes'”.
Web discussions showed that other people were plagued by this, but the WordPress core team was opposed to addressing it with an index, or in any other specific way. I had to do it myself.