Agent skill · data analytics · jeremylongshore

optimizing-database-connection-pooling

Process use when you need to work with connection management.

Why this skill is useful

Provides specific configuration patterns and calculations for optimizing database connection pooling that the AI wouldn't reliably generate on its own.

What it needs

Requires odyssey, pgbouncer, proxysql installed locally. About 4k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

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 psql or mysql CLI for querying connection metrics Access to database configuration files (postgresql.conf, my.cnf) for maxconnections settings 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 1. Audit current connection usage by querying active connections: PostgreSQL: SELECT count() AS total, state, usename FROM pgstatactivity GROUP BY state, usename ORDER BY total DESC MySQL: SHOW STATUS LIKE 'Threadsconnected' and SHOW PROCESSLIST Compare against maxconnections setting to determine headroom 2. Calculate the optimal pool size using the formula: poolsize = (corecount 2) + effectivespindlecount. For SSD-backed databases, use corecount 2 + 1. A 4-core server with SSD storage should have a pool size of approximately 9. This formula applies per application instance. 3. Configure application-level connection pool parameters: minimumIdle: Set to 2-5 for low-traffic periods (avoids cold-start latency) maximumPoolSize: Set using the formula from step 2 connectionTimeout: 5-10 seconds (fail fast rather than queue indefinitely) idleTimeout: 10-30 minutes (release idle connections back to pool) maxLifetime: 30 minutes (prevent stale connections from accumulating) leakDetectionThreshold: 60 seconds (log warning for connections held too long) 4. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/optimizing-database-connection-pooling

View the source on GitHub

Browse the @skills marketplace