<p>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:
<a href="https://craftcms.stackexchange.com/questions/26886/caching-in-craft-3-causes-out-of-memory-when-including-grouped-for-loop">Caching in Craft 3 causes out of memory when including grouped for loop</a></p>

<p>I ended up using the Cache Flag plugin to work around this.</p>

CC BY-SA 4.0
2018-10-30T02:03:33.747Z
The other thing to consider is that at some point, another form of caching might be in order. FastCGI Cache, Varnish, etc.
andrew.welch
CC BY-SA 4.0
2018-10-29T18:01:11.727Z
2018-10-29T18:01:11.727Z
KSP
<p>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.</p>

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

<p>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.</p>

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

CC BY-SA 4.0
2018-10-29T23:49:27.077Z
I updated craft-scripts to exclude the `templatecachequeries` when doing the db dumps: https://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.
andrew.welch
<craft3><cache>
Cache table filling too quickly
# Cache table filling too quickly

(Asked by: username_0 on 2018-10-29)

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)

**Tags:** craft3, cache
> **Comments:**
> **username_1**: I updated craft-scripts to exclude the `templatecachequeries` when doing the db dumps: https://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.  

---

## 1 answers

### Answer by username_2 on 2018-10-29. Score: 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](https://craftcms.stackexchange.com/questions/26886/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.

> **Comments:**
> **username_1**: The other thing to consider is that at some point, another form of caching might be in order. FastCGI Cache, Varnish, etc.  

---

