WordPress 6.1 Contains "Massive Improvement To Database Performance" – Search Engine Journal

WordPress 6.1 Contains "Massive Improvement To Database Performance" – Search Engine Journal

WordPress 6.1 contains an improvement that will produce significant performance gains by caching database queries
WordPress 6.1, scheduled for November 2022, will feature a “massive improvement to database performance” thanks to new post query caching.
This new feature promises to make WordPress websites perform faster.
The exact caching improvement is to the post query caching.
In the Twitter thread announcement someone asked if this improvement was already launched in version 6.0.
According to the WordPress core contributor who worked on this project, the caching feature will result in a dramatic improvement.
The core contributor tweeted:
“In WordPress 6.1, there is a massive improvement to database performance.
Database queries in WP_Query are now cached. A ticket I have been working on for 5+ years was merged.
This should result in billions of less repeated database queries”
A draft dev note was also begun containing more information about the cache:
“WordPress 6.1 includes an improvement to how database queries are performed in the ‘WP_Query’ class so that the result of database queries will be cached in object caching.
This means that if the same database query is run more than once, the result will be loaded from cache.
For those who are using persistent object caching, this will mean that until caches are invalidated, the database query will not be run again, resulting in far few queries to the database.”
They asked:
“Thanks! Wasn’t there an improvement already in 6.0?
With that we had major issues on big woo-stores: disappearing categories on archives pages when only child categories are checked, not the top level (parent) categorie.
Curious about the note with more context”
The WordPress core committer responded:
“We are improve database performance all the time.
There was improved to term query caching in 6.0. This is post query caching. Related but not the same.
That issue was patched in 6.0.1. I patched it myself.”
WordPress stores various parts of the website in a database.
A database contains information about the site organized into tables.
For example, all of the content for webpage posts are stored in a table.
When someone visits a webpage, WordPress will “query” the database to search and find the content for that webpage in the database.
WordPress makes multiple queries to the database for every requested webpage and does it for every site visitor.
Consequently that can become a heavy load on a server when it happens thousands of times per minute, resulting in slower database performance which in turn slows down the entire site.
With this new database caching feature, instead of making a database query it will instead first check if what it’s looking for is in a cache and pull the information from there.
It’s analogous to placing an order for lunch and instead of having to wait for the lunch to be made, the order taker reaches beneath the counter and produces it right away.
The unofficial announcement was enthusiastically received.
Congrats. Such a huge impact.
— Elie Sloïm (@ElieSl) September 27, 2022
Fair play to you, this is huge in many aspects. Cannot wait to try this out. Many many many thanks for all your hard work and persistence!
— Simon Pollard (@smp303) September 27, 2022
Nice one, Jonny! Very cool that you can have a positive impact at that scale.
— Keith Devon (@keithdevon) September 27, 2022
Brilliant! Always bugged me you had to jump through hoops to avoid duplicate queries with this.
— Jon Brown (@jb510) September 27, 2022
Despite the enthusiastic tweet announcing that this feature will be in the next WordPress release,  a  last minute issue arose that seemed to cast doubt on whether  this feature will make it into the next WordPress release.
The GitHub ticket for the cache project was closed, meaning that all the bugs seemed to be worked out and it was finished.
But hours later the same WordPress contributor reopened the ticket because new issues were discovered.
The problem that was discovered had to do with persistent Object Caching.
They wrote an explanation:
“Reopening, as I have discovered a couple of issues when persistent Object Caching.
Issue 1 – Cache add is called a lot when persistent Object Caching is enabled. This is because update_post_caches is called. This function should not be called when object cache is enabled.
Issue 2 – Cache set is called every WP_Query run, not only the first.”
A new GitHub pull release was opened to document the fix for the newly discovered issues.
I reached out to the developer via direct message on Twitter and he responded that there will not be a delay.
He confirmed that as of today there are six weeks left and these newly discovered issues will be fixed and the new caching feature will be included in WordPress 6.1.
Several days later the GitHub pull release for this feature was updated to note that the issues have been resolved.
The comment noted:
“Query: Save excessive cache add and sets in WP_Query.
In [53941] database query caching was added to WP_Query. However on sites with persistent object caching enabled, this resulted in a high number of unnecessary cache set and adds being run on every request. Caches are not set, if the query cache already exists and is cached. Replace usage of update_post_caches with _prime_post_caches to ensure that only posts that are not in cache are primed.”
Then immediately following that comment the core contributor noted:
Nothing has been officially announced yet but that’s not unusual. Every release contains hundreds of improvements and the most important are generally highlighted on the actual day of release.
Expect the new feature that will improve WordPress performance to land in version 6.1, currently scheduled for November 2022.
Featured image by Shutterstock/iViDI Studio
Roger Montti is a search marketer with over 20 years experience. I offer site audits, phone consultations and content and …
Get our daily newsletter from SEJ’s Founder Loren Baker about the latest news in the industry!
Subscribe to our daily newsletter to get the latest industry news.
Subscribe to our daily newsletter to get the latest industry news.


How do I find SEO services
Dominate search engine result pages, crush your competition, get more sales, and be the #1 provider in your service area. Work with Top SEO Agency in Dublin that also provides quality Digital Marketing Optimisation services. 
Our Search Sngine Optimisation Consultants will improve your site performance in all major search engines by implementing the Best SEO Solutions, Strategies and Techniques. Let us help you increase organic traffic, get more leads, more customers, and grow your revenue with a customised affordable SEO package.
Fully Managed WordPress Hosting


Get in touch

Globe Boss

Hampton Square
Dublin - Ireland
Tel: (+353)1 868 2345