How the natural sort order and pagination/product count options work in the Super Speedy Plugins plugin

Dave Hilditch
Talk to me

There are a few extra options in version 2.7 of the Super Speedy Plugins Performance Plugin to help you get more speed from your WordPress website.

In the video below, I show how this enables me to get sub-second page speed on the /shop/ page of a largish demo site I have (817,000 products loaded using Datafeedr).

Prior to enabling the options, WP_Query is taking about 3.7 seconds to fetch the first 50 products and after enabling the relevant options this drops to 0.008 seconds. That lets you scale your site to as many millions of products as you require. There are some caveats.

How to measure your performance and choose the right options

I highly recommend you install the Query Monitor plugin. The Super Speedy Plugins Performance Plugin gets most of its speed boosts through optimising database queries and the Query Monitor is great for telling you exactly how much time each database call is taking.

Sort order option

lets you use the natural sort order on wp_posts rather than forcing WordPress to sort the posts every time. Sorting can be expensive if you have a lot of products, whereas indexes are pre-sorted meaning very little CPU or disk required to grab the data.

Calculate totals option

This lets you switch off SQL_CALC_FOUND_ROWS which is what WordPress uses for pagination. This is the little bit of functionality which allows the page to display: Showing 1 – 50 of 817,000 products. But that count can be expensive and heavy on the database, depending on how large the category you are viewing and whether a table scan or index scan occurs. Using this option breaks pagination, but massively speeds up the queries. If you’re happy to break pagination, it’s a great option for extra speed and you can use infinite scroll instead.

Load WooCommerce product pages using Ajax/iFramce

Because the calculate totals option breaks pagination, infinite scroll/continuous scroll would need to be used instead. The major problem with infinite scroll is when a user clicks to the product/post detail page and then clicks back, they end up back at page 1 again. This option allows you to tell WordPress to load the product/post detail (single) page using an iframe and not actually navigate away from the archive page. The URL still updates (using similar tech to GMail) and then the back button gets overridden to hide the iframe and reveal the archive page again.

What this means is that a user can scroll down to page 4 or 5 or whatever of your infinite scrolling archive, click a product/post, then click back and end up back at the exact spot they were at without any extra server-load or waiting or scrolling required to get back to where they were. This is better for your server and better for your user experience.

sort-order-options-for-max-wpi-wordpress-speed

Version 2.7 is due to be released 15th August once I’ve tested it thoroughly on all my various test environments.

Be the first to comment and we'll reply right away.

Leave a reply

Super Speedy Plugins
Logo