optimizing-database-connection-pooling
Installation
SKILL.md
Database Connection Pooler
Overview
Configure and optimize database connection pooling using external poolers (PgBouncer, ProxySQL, Odyssey) and application-level pool settings to prevent connection exhaustion, reduce connection overhead, and improve database throughput.
Prerequisites
psqlormysqlCLI for querying connection metrics- Access to database configuration files (
postgresql.conf,my.cnf) formax_connectionssettings - PgBouncer, ProxySQL, or Odyssey installed if using external pooling
- Application connection pool settings accessible (database URL, pool size parameters)
- Server CPU core count and available memory for pool sizing calculations
Instructions
- Audit current connection usage by querying active connections:
- PostgreSQL:
SELECT count(*) AS total, state, usename FROM pg_stat_activity GROUP BY state, usename ORDER BY total DESC - MySQL:
SHOW STATUS LIKE 'Threads_connected'andSHOW PROCESSLIST - Compare against
max_connectionssetting to determine headroom
- PostgreSQL: