Postgresql – horizontal scaling and load-balancing for PostgreSQL with ProxySQL

load balancingpostgresqlscaling

I have a PostgreSQL DB running in Google Cloud SQL that I need to scale horizontally. Cloud SQL makes it easy to add read-only replicas, but does nothing to help with load-balancing traffic to the replicas.

I'm looking for something that will help me with load-balancing between the replicas. My app is running in Kubernetes (on GKE in the same cloud project as the database) so if the solution can be deployed to Kubernetes that would be great.

There's lots of good tutorials for doing this using ProxySQL but they all assume you are using MySQL, and the ProxySQL config file seems to have MySQL specific fields, but I haven't found anything that explicitly says "you can't use ProxySQL with PostgreSQL" or "ProxySQL does work with PostgreSQL, and here's how to do it…"

So my question is can I use ProxySQL with PostgreSQL? If so, what would the config file look like? If not what equivalent can I use instead?

Best Answer

As far I know, ProxySQL works only with MySQL(e.g. MariaDB, Percona and e.t.c.). May be SQLRelay would be suitable for you.

Related Topic