ProxySQL 3.0 introduces powerful capabilities like dynamic query routing, caching, multiplexing, and now PostgreSQL support. This blog explains how ProxySQL improves database performance, enables intelligent load balancing, and helps scale MySQL and PostgreSQL environments without application changes. Backed by real-world use cases from Mafiree, it provides practical insights into when and how to use ProxySQL effectively in production.
Jethish March 24, 2026
Managing high-traffic databases is never just about scaling hardware. One poorly optimized query can degrade performance, overload your primary node, and impact user experience across your application.
This is exactly where ProxySQL 3.0 features come into play.
Whether you're running ProxySQL for MySQL, exploring ProxySQL for PostgreSQL, or managing hybrid environments, ProxySQL acts as a smart SQL-aware proxy that enables routing, caching, rewriting, and load balancing—without requiring any application changes.
At Mafiree, we’ve implemented ProxySQL across 50+ production environments—helping teams resolve real-world challenges like sudden query spikes, inefficient read scaling, and unpredictable database load. Our experience shows that the right ProxySQL strategy can prevent downtime, improve performance, and give teams much better control over their database traffic.
If you're evaluating proxysql features for production workloads, this guide will help you understand where it fits, how it performs, and when to use it.
The biggest shift in ProxySQL 3.0 features list is clear:
➡️ Native PostgreSQL support (Beta)
This means you can now use ProxySQL + PostgreSQL alongside MySQL within the same architecture.
? Read more: https://www.mafiree.com/readBlog/proxysql-features
? Explore routing use cases: https://www.mafiree.com/readBlog/dynamic-query-routing-with-proxysql
At the heart of all proxysql features lies one powerful capability: query routing.
ProxySQL inspects incoming SQL queries and routes them based on:
This allows full control over how traffic flows across your database cluster.
A classic example in postgresql load balancing:
SELECT → Read ReplicaINSERT/UPDATE/DELETE → PrimaryThis is the foundation of any postgresql load balancing cluster.
Even something like:
SELECT * FROM orders LIMIT 10;
or
SELECT * FROM users LIMIT 13;These common postgresql limit example (10, 13) queries can be automatically routed to replicas to reduce primary load.
For PostgreSQL DBAs, this is huge.
ProxySQL for PostgreSQL brings SQL-aware routing—something traditionally missing in most PostgreSQL proxy layers.
Security is production-critical:
These aren’t just technical features—they directly impact performance and cost.
Instead of opening thousands of DB connections:
Frequently executed queries are served from memory:
Unlike traditional tools, ProxySQL is SQL-aware:
ProxySQL continuously:
Choosing the right tool matters.
| Feature | ProxySQL | HAProxy |
|---|---|---|
| SQL awareness | ✅ | ❌ |
| Query routing | ✅ | ❌ |
| Load balancing | ✅ | ✅ |
| Query rewrite | ✅ | ❌ |
| Feature | ProxySQL | MySQL Router |
|---|---|---|
| Query routing | Advanced | Basic |
| Query caching | ✅ | ❌ |
| Observability | High | Limited |
| Flexibility | High | Medium |
Heavy read traffic?
ProxySQL routes reads to replicas automatically.
No need to rewrite your app:
Offload reporting queries:
At Mafiree, we've implemented ProxySQL across 50+ production environments.
A developer released a heavy query that caused production slowdown.
Instead of:
We:
This is the real power of proxysql + postgresql in production.
When you use ProxySQL to manage PostgreSQL traffic, it typically uses two TCP ports to separate admin and client traffic,
| Port | Purpose | Details |
|---|---|---|
| 6132 | Admin Interface Port | Used for ProxySQL administration and configuration connections. You connect here to configure ProxySQL (add users, backends, rules, etc.) via the ProxySQL admin protocol. Often accessed via the mysql client or ProxySQL admin tools. |
| 6133 | Client Query Port | The port where PostgreSQL clients connect to ProxySQL to send their actual SQL queries. ProxySQL listens on this port to proxy client connections to the PostgreSQL backend servers based on configured rules and hostgroups. |
1. Connect to ProxySQL Admin Interface (port 6132)
psql -u admin -padmin -h 127.0.0.1 -P 61322. Add Backend PostgreSQL Servers
INSERT INTO pgsql_servers (hostgroup_id, hostname, port, status, comment)
VALUES
(1, '172.17.0.9', 5432, 'ONLINE', 'primary'),
(2, '172.17.0.3', 5432, 'ONLINE', 'replica');3. Add PostgreSQL Application User
INSERT INTO pgsql_users (username, password, default_hostgroup)
VALUES ('appuser', 'appuser', 1);The password must match the user's password in the actual PostgreSQL backend.
4. Save to Runtime and to Disk
Apply the changes so they take effect:
-- Save changes to runtime
LOAD PGSQL SERVERS TO RUNTIME;
LOAD PGSQL USERS TO RUNTIME;
-- Persist to disk
SAVE PGSQL SERVERS TO DISK;
SAVE PGSQL USERS TO DISK;5. View Current Config
select * from pgsql_servers;
+--------------+------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 1 | 172.17.0.9 | 5432 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | primary |
| 2 | 172.17.0.3 | 5432 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | replica |
+--------------+------------+------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
select * from pgsql_users;
+---------------+----------+--------+---------+-------------------+------------------------+--------------+---------+----------+-----------------+------------+---------+
| username | password | active | use_ssl | default_hostgroup | transaction_persistent | fast_forward | backend | frontend | max_connections | attributes | comment |
+---------------+----------+--------+---------+-------------------+------------------------+--------------+---------+----------+-----------------+------------+---------+
| appuser | appuser | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 10000 | | |
+---------------+----------+--------+---------+-------------------+------------------------+--------------+---------+----------+-----------------+------------+---------+1. Connect PostgreSQL Client to ProxySQL
Use psql to connect through ProxySQL’s PostgreSQL listener port 6133:
psql -h 127.0.0.1 -p 6133 -U appuser -d postgres2. Run a Sample Query
Once connected, you can execute any SQL query, just like you'd do directly against PostgreSQL:
Mafiree@Proxy_Machine:~$ psql -h 127.0.0.1 -p6133 -U appuser -d postgres -c "select * from sports;"
Password for user appuser:
id | sport_name | team_name | player_name | position | team_city | founded_year | championships_won
----+------------+-----------------------+--------------------+---------------+---------------+--------------+-------------------
1 | Basketball | Los Angeles Lakers | LeBron James | Forward | Los Angeles | 1947 | 17
2 | Basketball | Golden State Warriors | Stephen Curry | Guard | San Francisco | 1946 | 7
3 | Football | New England Patriots | Mac Jones | Quarterback | Foxborough | 1959 | 6
4 | Football | Kansas City Chiefs | Patrick Mahomes | Quarterback | Kansas City | 1960 | 3
5 | Baseball | New York Yankees | Aaron Judge | Right Fielder | New York | 1903 | 27
6 | Baseball | Los Angeles Dodgers | Mookie Betts | Right Fielder | Los Angeles | 1883 | 7
7 | Soccer | Manchester United | Bruno Fernandes | Midfielder | Manchester | 1878 | 20
8 | Soccer | FC Barcelona | Robert Lewandowski | Striker | Barcelona | 1899 | 26
9 | Hockey | Toronto Maple Leafs | Auston Matthews | Center | Toronto | 1917 | 13
10 | Hockey | Chicago Blackhawks | Patrick Kane | Right Wing | Chicago | 1926 | 6
11 | Hockey | Toronto Raptors | James Winner | Forward | Toronto | 2000 | 1
12 | Hockey | Toronto Raptors | James Winner | Forward | Toronto | 2000 | 1
(12 rows)In addition to PostgreSQL features, we will now review the major and minor enhancements for MySQL introduced in ProxySQL.
You can now configure two passwords for the same MySQL user—a primary and a secondary. This is extremely useful for zero-downtime password rotation in production environments.
mysql> INSERT INTO mysql_users (
-> username,
-> password,
-> attributes,
-> default_hostgroup,
-> transaction_persistent,
-> active
-> ) VALUES (
-> 'appuser',
-> CACHING_SHA2_PASSWORD('new_pass'), -- New password
-> JSON_OBJECT('additional_password', HEX(CACHING_SHA2_PASSWORD('old_pass'))), -- Old password
-> 1,
-> 1,
-> 1
-> );
Query OK, 1 row affected (0.01 sec)mysql -u appuser -p -h 172.17.0.4 -P 6033
# enter password: new_passmysql -u appuser -p -h 172.17.0.4 -P 6033
# enter password: old_passIt should also connect successfully because of the additional_password attribute.
Logging has been completely upgraded in 3.0. ProxySQL now uses:
This is perfect for:
Previously, if your app used prepared statements, the logs only showed the query skeleton—not the actual values.
Now in 3.0, ProxySQL logs the real parameter values, so you can:
{
"hostgroup_id": 3,
"thread_id": 196854,
"event": "COM_STMT_EXECUTE",
"username": "Mysql_app",
"schemaname": "Sports",
"client": "192.168.72.44",
"server": "172.17.0.4",
"rows_affected": 3,
"query": "SELECT * FROM sports.players WHERE age > ?",
"starttime_timestamp_us": 1758000000000000,
"starttime": "2025-06-02 08:30:00.000000",
"endtime_timestamp_us": 1758000000100000,
"endtime": "2025-06-02 08:30:00.100000",
"duration_us": 100000,
"digest": "0xabcdef1234567890",
"client_stmt_id": 101,
"parameters": [
{
"type": "INT",
"value": "25"
}
]
}
Common mistakes:
Solution:
When comparing postgresql vs sql server performance, ProxySQL adds an extra layer of optimization:
This often gives PostgreSQL clusters a performance edge in read-heavy workloads.
Miru IT Park, Vallankumaranvillai,
Nagercoil, Tamilnadu - 629 002.
Unit 303, Vanguard Rise,
5th Main, Konena Agrahara,
Old Airport Road, Bangalore - 560 017.
Call: +91 6383016411
Email: sales@mafiree.com