Have been using nystudio107 scripts to manage database workflow. Just launched first Craft 3 site and noticed that when i went to sync the database locally from server the /tmp partition on the server maxed out in seconds and brought the whole server down when trying to copy the database.

The culprit turned out to be 5G of cache content in craft_templatecachequeries which maxed out the partition tmp size (4GB)

I had added cache tags around main for loops, but i spotted that i had lazily tried to cache the whole news index page with the news index template being cached from top to bottom. I have removed these.THe cache table size has improved to a more stable 1GB but that seems incredibly high still.

Is this normal for Craft3? (I guess there is a possible separate issue with scripts for db sync/pulling)

  • I updated craft-scripts to exclude the templatecachequeries when doing the db dumps: github.com/nystudio107/craft-scripts/releases/tag/1.2.9 -- but your real problem is that these tables are getting that large to begin with. If you use clear_caches.sh on deploy, it will empty these tables for you. Commented Oct 29, 2018 at 23:49

1 Answer 1


I'm not sure if it's the same thing, but if the queries you are caching are complex (nested queries, etc), it may be caused by the queries being serialized in Craft 3. Have a look at Brad's answer to a question I had a while go, to see if it covers your case as well: Caching in Craft 3 causes out of memory when including grouped for loop

I ended up using the Cache Flag plugin to work around this.

  • 1
    The other thing to consider is that at some point, another form of caching might be in order. FastCGI Cache, Varnish, etc. Commented Oct 30, 2018 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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