PgBouncer: The one with prepared statements
Neon now runs PgBouncer 1.22.0, which supports protocol-level prepared statements (added in 1.21.0) plus DEALLOCATE ALL and DISCARD ALL, and claims 15% to 250% higher query throughput. SQL-level PREPARE/EXECUTE still won't work through the pooler. Protocol-level prepared statements from client libraries such as psycopg2 and node-postgres do work. PgBouncer tracks each unique query string, gives it an internal name like PGBOUNCER_123, prepares it on the server connection if needed, and rewrites client commands to use that name.
Related posts
- PgBouncer is now available in Supabase
Supabase mediumAdeptSupabase now bundles PgBouncer, co-located on the same server as each new project's Postgres, so serverless functions that open a connection per request don't overwhelm the database. The pooler keeps a fixed set of connections open, currently a pool size of 15, and queues clients when all are busy rather than raising Postgres's connection limit. Three pool modes are available: session (full feature support), transaction (recommended for serverless, but no session features like prepared statements) and statement (no multi-statement transactions, suited to autocommit). Pooling applies to new projects only.
- Better Postgres with Prisma Experience
Neon mediumAdept
Prisma users on Neon can now use a single pooled Postgres connection string for both serverless queries and schema migrations, replacing separate pooled, direct and shadow database URLs. PgBouncer 1.22.0 added support for prepared statements and DISCARD ALL/DEALLOCATE ALL, which fixes the "prepared statement already exists" errors `prisma migrate` used to hit through the pooler, and the `pgbouncer=true` parameter is no longer needed. Neon also enabled role and database management via SQL, and Prisma 5.10.0 added DROP DATABASE WITH (FORCE), so `prisma migrate dev` can create and drop its own shadow database without manual setup.
- PGKeeper: Building the bouncer we needed for Postgres
Figma mediumAdept
Figma replaced PgBouncer with PGKeeper, a Go service built on PGX that sits between its DBProxy router and each Postgres instance. Clients reach it over gRPC with per-query metadata such as traffic tier and request source. PgBouncer was ruled out for its single-threaded scaling ceiling, lack of prioritization and backpressure, and weak protection against connection churn. Pooling inside DBProxy was ruled out because hundreds of replicas cannot share a ~100-connection pool, and PGCat would have required a fork. PGKeeper token-bucket rate-limits both connection creation and teardown, warms pools before taking traffic, and avoids churn with bounded result draining, automatic ROLLBACK, and context cancellation via pg_cancel_backend plus SELECT 1. Its priority-based semaphore admission control uses CoDel to shed stale lower-priority work during concurrency spikes.
- Performance tips for Neon Postgres
Neon mediumAdept
Neon's serverless Postgres follows mostly standard Postgres tuning, plus a few Neon-specific checks. Size compute at roughly 100 connections per GB of RAM, use pooling and autoscaling, then find slow queries with pg_stat_statements and EXPLAIN (ANALYZE, BUFFERS). Fix them with indexes, REINDEX and autovacuum tuning against bloat, and by keeping the local file cache hit ratio (shown in neon_stat_file_cache) above 99%. For faster ingests, batch inserts, drop unused indexes, offload reads to ephemeral read replicas, and test changes safely on a database branch.
- Supavisor 1.0: a scalable connection pooler for Postgres
Supabase mediumAdeptSupavisor 1.0, Supabase's Elixir-based Postgres connection pooler, is production-ready and adds query load balancing, named prepared statement support in transaction mode, and query cancelation. All SQL is now parsed via pg_query.rs through Rustler. Reads are randomly spread across primary and replicas, while writes find the primary by probing until a write succeeds, which adds a few milliseconds but makes failover transparent. PREPARE statements are broadcast to all backend connections, trading some memory for throughput. The release also raises default client limits for smaller projects and uses IPv4-to-IPv6 mediation to avoid AWS IPv4 charges.