Join GitHub today
hostgroups, query rules and temporary tables #941
I have 2 hostgroups: 500 for WRITE, 501 for READ.
I have the following rules:
As you can see, temporary tables are created in the READ group. But I can't find a way how to insert into the temporary table, because my INSERTs and UPDATEs go into the WRITE group.
Perhaps, a modification to proxysql is needed - where it detects temporary table creation and then directs all reads and writes to it through the backend where it was created?
I think the problem is in these two rules:
The first time I wrote them was to show how routing works, and of course examples should be easy to understand.
The common configuration procedure (or guideline) should be the following:
The idea is therefore quite simple: send to slaves/readers only what you want to send to slaves, not just any SELECT.
I have tons of heavy queries and my Percona cluster is in full sync mode (wsrep_sync_wait=1). My system automatically replays deadlock queries (and I have probably only 1 deadlock query once per week). Proxysql helped me even out the load. So I prefer SELECTs on all servers.
I found a dirty hack. It sends all queries that start with a comment /* TEMP */ to the READ hostgroup.
I prepend all my queries that have to work with temporary tables with /* TEMP */. And told Proxysql to direct such requests to the READ group.
So now my queries look like this:
Let's keep this ticket alive for anyone googling this same problem.
But still, it would be awesome if Proxysql could detect temporary tables automatically and lock all queries to them to a specific backend.
Not sure if I would call it a dirty hack, of the right approach :)
Weird. Looks like I can CREATE a table, INSERT into it, but not SELECT.
Here are my query rules:
Any ideas what could be wrong?
Here are my new query rules.