ProxySQL: The MySQL Proxy That Thinks — Query Rules, Multiplexing, and Runtime Control
ProxySQL is the most feature-complete MySQL and MariaDB proxy available. Its query rules engine lets you route, rewrite, cache, or block any query based on regex patterns — with zero restarts. Connection multiplexing makes it the only MySQL proxy that reduces backend connections below the client connection count.
What Makes ProxySQL Unique
ProxySQL parses every MySQL protocol packet and applies a rule engine before forwarding. This intelligence enables capabilities no other MySQL proxy provides — including multiplexing and in-proxy query caching.
Query Rules Engine
Route any query to any hostgroup using regex rules on username, schema, digest, or query text. Rewrite queries on-the-fly. Mirror traffic to a test cluster. All configurable at runtime.
Connection Multiplexing
ProxySQL can serve 10,000 client connections with only 200 server connections using multiplexing — far beyond what MySQL itself supports. Reduces backend MySQL memory by 80%+.
Detailed Query Statistics
stats_mysql_query_digest tracks every unique query digest — count, latency, rows sent, first/last seen. Essential for finding slow queries without enabling MySQL's slow query log.
SQL Firewall
Block queries matching patterns before they reach MySQL. Protect against accidental table scans, DELETE without WHERE, or specific attack patterns. Rules applied at the proxy with zero MySQL overhead.
In-Memory Query Cache
Cache SELECT results in ProxySQL's internal cache. Serve repeated identical queries without touching MySQL. TTL-based expiry. Particularly effective for dashboards and reporting queries.
Runtime Reconfiguration
Every ProxySQL setting — routing rules, backend servers, users, timeouts — can be changed via SQL admin interface without restarting. LOAD TO RUNTIME; SAVE TO DISK applies changes in milliseconds.
ProxySQL vs MaxScale vs MySQL Router
All three proxy MySQL connections, but with very different feature sets, licensing, and use cases. ProxySQL is the only one that is both fully open-source and feature-complete.
| Feature | ProxySQL ✦ | MaxScale | MySQL Router |
|---|---|---|---|
| Query rule-based routing | |||
| Connection multiplexing | |||
| Runtime reconfiguration (no restart) | |||
| SQL firewall / query blocking | |||
| Query result caching | |||
| Read/write split | |||
| MySQL InnoDB Cluster support | |||
| MariaDB support | |||
| Percona XtraDB Cluster support | |||
| Admin SQL interface | |||
| Open source (free) | |||
| Detailed per-query statistics |
When to Choose Each Proxy
Choose ProxySQL when…
- • You need granular per-query routing control
- • High connection count — multiplexing is essential
- • You want detailed per-query performance analytics
- • SQL firewall / query blocking is required
- • Running Percona XtraDB Cluster or Galera
- • Open-source with no licensing cost is required
- • Runtime config changes without downtime are critical
Choose MaxScale when…
- • You have a MariaDB Enterprise subscription
- • You need MaxScale-specific filters (binlog router, Avro CDC)
- • Deep integration with MariaDB Galera is needed
- • Commercial support from MariaDB is a requirement
Choose MySQL Router when…
- • You run MySQL InnoDB Cluster — Router is the official frontend
- • Simple topology-aware routing is sufficient
- • You want the officially supported Oracle MySQL proxy
- • No advanced query routing rules are needed
JusDB ProxySQL Implementation Service
Hostgroup & Backend Configuration
Define writer hostgroup (primary), reader hostgroup (replicas), and backup hostgroup. Configure health checks, max_connections, and weight for each backend.
Query Rules Design
Build regex-based query rules for read/write split, schema routing, query rewriting, and traffic mirroring. Audit application queries to identify routing patterns.
Connection Multiplexing Tuning
Configure mysql-multiplexing, connection_max_age, and per-user connection limits to maximise multiplexing efficiency and reduce MySQL backend connections.
SQL Firewall Rules
Implement query blocking rules for dangerous patterns: full table scans, DELETE/UPDATE without WHERE, schema enumeration queries.
Stats & Query Digest Monitoring
Set up stats_mysql_query_digest monitoring with Prometheus export for latency distribution, error rates, and top slow query identification.
HA ProxySQL Cluster
Deploy ProxySQL Cluster (multi-instance sync) so all ProxySQL nodes share the same configuration. Pair with keepalived for VIP failover.
FAQ
Take control of your MySQL traffic
JusDB designs and deploys ProxySQL with the right query rules, multiplexing configuration, and HA setup for your specific MySQL/MariaDB workload.