Skip to content

How to solve the large _transient_dirsize_cache issue?

The _transient_dirsize_cache stores information about your media library directories that’s only needed in admin areas. By simply changing the autoload parameter to “no,” you maintain all functionality while significantly improving site performance. This quick fix has helped countless site owners achieve dramatic speed improvements without complex optimizations.


One overlooked setting could be slowing your WordPress site to a crawl. Discover how changing a single autoload parameter for _transient_dirsize_cache can deliver dramatic performance gains without losing functionality. Your visitors (and server) will thank you.

How to solve the large _transient_dirsize_cache issue
TL;DR
  • The _transient_dirsize_cache option in WordPress can significantly impact site performance if set to autoload "yes" due to its large size in sites with extensive media libraries.
  • Changing the autoload setting for _transient_dirsize_cache to "no" can improve performance by preventing unnecessary data from loading on every page request.
  • WordPress transients are temporary storage for data that is slow to create but doesn't change often, and they are stored in the database's wp_options table.
  • Setting _transient_dirsize_cache to autoload "no" optimizes site speed without affecting functionality, as the data is only needed in specific admin areas.

Many WordPress administrators face performance challenges that can often be traced to database optimization issues. One specific configuration that merits attention is how the _transient_dirsize_cache option is handled.

When this transient is set with autoload “yes” (the default), it loads into memory with every page request. For sites with extensive media libraries, this can significantly impact performance as the cache grows in size—sometimes reaching tens of megabytes.

Setting _transient_dirsize_cache autoload to “no” has proven to be an effective solution for many site managers, resulting in measurable performance improvements without compromising functionality.

Understanding WordPress transients

What are WordPress transients?

Think of them as temporary storage containers for information. WordPress uses transients to save data that takes time to create but doesn’t change often.

Transients live in your site’s database, more specifically, in the wp_options table. Each has a name, value, and (usually) an expiration time.

The _transient_dirsize_cache In detail

The _transient_dirsize_cache is special because it stores information about how big your upload folders are. Unlike many regular transients, this one historically had an issue with expiration.

This cache specifically stores detailed size information for every directory in your uploads folder. WordPress uses this data primarily in three places: the Media Library dashboard, Site Health reports, and when uploading new files.

What makes this transient problematic is its size – it can grow to tens of megabytes on sites with extensive media libraries. When set to autoload “yes,” this massive chunk of data loads on every single page view, even though it’s only needed in the admin area.

Setting it to autoload “no” keeps the data available when needed without slowing down your entire site. This issue was discussed in detail in WordPress Core Trac ticket #54221.

The WordPress 6.4 fix

Good news! The issue of large _transient_dirsize_cache was fixed in WordPress 6.4. The update implemented proper expiration settings for this transient to prevent it from growing excessively large.

However, this fix isn’t retroactive, which means that if your site was affected before updating to WordPress 6.4, you should manually delete the existing _transient_dirsize_cache entry from the wp_options table. This allows WordPress to recreate it with the new expiration settings.

The autoload parameter explained

What is autoload in WordPress? 

It’s like a switch that tells your website whether to load certain information right away or wait until it’s needed.

When an option in your database has autoload set to “yes,” WordPress loads it automatically whenever any page loads. When set to “no,” it only loads when requested.

Most transients default autoload to “yes.” This works fine for small bits of data, but becomes problematic for those that could potentially get too big, like _transient_dirsize_cache.

The performance impact can be significant – autoloaded data increases memory usage and slows down every single page load across your site.

Conclusion

Setting autoload to “no” for the _transient_dirsize_cache is safe for most WordPress sites and can significantly improve performance. The change only affects how quickly your admin dashboard displays certain information while bringing substantial speed improvements to your entire site.

BoostBuddy.io

Stay ahead with fast and optimized website that converts better!

OR

Get the complete performance checklist for just $20 $169 here!