I just noticed that on a site we launched a month ago, the templatecachequeries table is now 500mb. I'm only using the {% cache %} tag in one place on the site, around the main content matrix field. There are about 52000 rows in the templatecachequeries table now.

I've cleared the caches from Utilities, and I've re-saved all the sections but the rows are all still there. Are these meant to get deleted at some point? Is it safe to delete the rows?


You can clear the cache from within the settings section of the control panel. It's possible to select which specific caches to clear if necessary.

You can try manually clearing the cache tables. Test it on a backup first but I have done this in the past with no ill effects.

It sounds like you need to be adding the "globally" keyword to your cache tags. This will drastically reduce the number of rows in the cache table and most likely speed things up too.

| improve this answer | |
  • Thank you. A few days later it seems that the database size has reduced back down to 2mb after removing the cache tags, even though it wasn't working before - perhaps it just took a while to delete all the rows. Thanks! – darylknight Oct 4 '18 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.