The new post query caching in WordPress 6.1 will bring a “massive improvement to database performance” by the time of its release in November 2022.

The hope is that WordPress pages will load a lot quicker thanks to this new enhancement.

Details of the improvement

The WordPress core developer who worked on this project claims that the caching function will result in a major enhancement.

The main developer posted on Twitter that the database speed has been significantly enhanced in WordPress 6.1.

Database queries in WP_Query can now be cached. Billions of unnecessary database queries should be avoided as a result of this.

A first version of a dev note detailing the cache was also started.

The ‘WP_Query’ class in WordPress 6.1 has been updated to better cache the results of database queries via object caching.

If the same database query is repeated multiple times, the result will be retrieved from the cache instead of the database.

Those who employ persistent object caching will have dramatically reduced database traffic because the query will not be re-run until the caches are invalidated.

Was this improvement already implemented in 6.0?

One Twitter user asked whether this improvement was already made in WordPress 6.0. 

The core WordPress contributor remarked that they continually work to enhance the efficiency of their databases.

Term query caching was enhanced in 6.0. Post-query caching, while sounding similar, is not the same thing.

About WordPress queries and database

When using WordPress, the website’s data is saved in a database.

Information about the site is stored in a database in the form of tabular data.

For instance, a table may be used to catalog all of a website’s blog entries.

When a user navigates to a specific page, WordPress will “query” the database to locate the relevant data.

For every page a user requests, WordPress sends numerous queries to the database.

When that happens hundreds of times each minute, it puts a strain on the server and slows down the database, which in turn affects the entire site’s speed.

Instead of directly querying the database for the information it needs, the new database caching feature will first check if it already exists in the cache and retrieve it from there.

It’s like putting a lunch order and having the cashier bring your meal from behind the register immediately, rather than having to wait for it to be prepared.

Last minute issues

At the time of the Twitter announcement of this WordPress feature, an issue arose that made the community question whether the feature would make it into the next WP release.

Fortunately, this issue has since then been resolved. It has been confirmed that the new caching function will be included in WordPress 6.1. in November 2022.