Fast Results

This very simple WordPress plugin reduces overuse of the notoriously expensive SQL_CALC_FOUND_ROWS statement modifier in MariaDB / MySQL. It can improve the user experience on sites with many posts or stores with many products, by speeding up the display of category and archive pages. The Products page of most WooCommerce stores is a category page.

The plugin puts the number of found rows into WordPress’s persistent object cache after each WP_Query operation that uses pagination. Subsequent similar statements use the cached value. Pagination presents a user interface like this, and allows users to navigate from page to page.

In this example, “1384” is the expensive-to-retrieve result of SQL_CALC_FOUND_ROWS. The plugin avoids recomputing it when users navigate from page to page.

This plugin does nothing useful except on sites that have a persistent object cache.

The plugin’s source code is here. An installable .zip file is here.

More details about how it works are here.