# Galera query\_cache\_size

**URL:** <https://forums.percona.com/t/galera-query-cache-size/3659>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [August 5, 2014, 11:23pm UTC](https://forums.percona.com/t/galera-query-cache-size/3659 "2014-08-05T23:23:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sergey\_Kurkin](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@Sergey\_Kurkin](https://forums.percona.com/u/Sergey_Kurkin)\
**Post date:** [August 5, 2014, 11:23pm UTC](https://forums.percona.com/t/galera-query-cache-size/3659/1 "2014-08-05T23:23:59Z")

</div>

Hi all,

what will happen if we still to set query\_cache\_size \>0 (everywhere query\_cache\_size =0 is viewed as mandatory) ?

Sergey

---

<div class="post-metadata">

**Author:** ![taka-h](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/taka-h/32/1023_2.png) [@taka-h](https://forums.percona.com/u/taka-h)\
**Post date:** [August 8, 2014, 2:46am UTC](https://forums.percona.com/t/galera-query-cache-size/3659/2 "2014-08-08T02:46:39Z")

</div>

Hi.

It depends on your load balancing method, I think.

cashing may be done within each node, so If you don’t balance read traffic with session persitency(ex. simple round robin),  
cost to create cash may increase and cash hit rate would be down.

Please also be aware that there is read consistency(wsrep\_causal\_reads) problem.

---

<div class="post-metadata">

**Author:** ![Sergey\_Kurkin](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@Sergey\_Kurkin](https://forums.percona.com/u/Sergey_Kurkin)\
**Post date:** [August 8, 2014, 3:41pm UTC](https://forums.percona.com/t/galera-query-cache-size/3659/3 "2014-08-08T15:41:46Z")

</div>

Hmm,

so if I’m using a couple of additional nodes only for backup  
(I mean that I use Galera with 3 nodes - 1 for all transactions, 2 for replications)

- I will have no bad situation and I can safely use cache ?  
Despite of requirements of official documents/sites…

---

<div class="post-metadata">

**Author:** ![taka-h](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/taka-h/32/1023_2.png) [@taka-h](https://forums.percona.com/u/taka-h)\
**Post date:** [August 8, 2014, 5:46pm UTC](https://forums.percona.com/t/galera-query-cache-size/3659/4 "2014-08-08T17:46:07Z")

</div>

thank you for reply.

this is my opinion.

Performance Issue

- additional cost for update, insert, delete query (cache update cost for all the node is needed).
- cost for select query is needed only on executed node.  
(but if your query is executed to the other node, there would be no caching, so cache hit rate would be worse)  
(\* galera cluster is well suited for balancing read traffic)

this is the same as mysql cluster (p.40)  
[url][http://www.slideshare.net/matkeep/mysql-cluster-performance-best-practices[/url]](http://www.slideshare.net/matkeep/mysql-cluster-performance-best-practices%5B/url%5D)

so query cache effect would be much worse than single node, eventual performance would be worse for most of the cases.

Consistency Issue(use safety)

- safe or not is deeply related to read consistency issue.
