---
title: "PgBouncer: The one with prepared statements"
description: "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."
url: "https://swe.quest/articles/pgbouncer-the-one-with-prepared-statements-cf01e34c375e84ba"
canonical: "https://neon.com/blog/pgbouncer-the-one-with-prepared-statements"
source: "Neon"
published: "2024-02-15"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 4
tags: ["postgres","databases","performance"]
---

# PgBouncer: The one with prepared statements

A post on [Neon](https://swe.quest/sources/neon.md), published 2024-02-15, 4 min read, Announcement. Original: [https://neon.com/blog/pgbouncer-the-one-with-prepared-statements](https://neon.com/blog/pgbouncer-the-one-with-prepared-statements)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- PostgreSQL basics ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- connection pooling concepts

## Keywords

PgBouncer, Neon, PostgreSQL, prepared statements, psycopg2, node-postgres

## Related posts

- [PgBouncer is now available in Supabase](https://swe.quest/articles/pgbouncer-is-now-available-in-supabase-7611d240679e4c4c.md): Supabase · 2021-04-02 · Medium · 4 min read · PostgreSQL, Serverless, Scaling
  Supabase 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.
- [Better Postgres with Prisma Experience](https://swe.quest/articles/better-postgres-with-prisma-experience-595f740758817ccf.md): Neon · 2024-03-07 · Medium · 4 min read · PostgreSQL, Schema migrations, Serverless, TypeScript
  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.
- [PGKeeper: Building the bouncer we needed for Postgres](https://swe.quest/articles/pgkeeper-building-the-bouncer-we-needed-for-postgres-b0a410376e101175.md): Figma · 2026-05-04 · Medium · 19 min read · PostgreSQL, Resilience, Go, Databases, Scaling
  Figma replaced PgBouncer with PGKeeper, a Go service built on PGX that sits between its DBProxy router and each Postgres instance.
- [Performance tips for Neon Postgres](https://swe.quest/articles/performance-tips-for-neon-postgres-9739985c47432424.md): Neon · 2024-04-04 · Medium · 8 min read · PostgreSQL, Performance engineering, Serverless, SQL
  Neon's serverless Postgres follows mostly standard Postgres tuning, plus a few Neon-specific checks.
- [Supavisor 1.0: a scalable connection pooler for Postgres](https://swe.quest/articles/supavisor-1-0-a-scalable-connection-pooler-for-postgres-561015cc29e3cac0.md): Supabase · 2023-12-13 · Medium · 3 min read · PostgreSQL, Elixir & Erlang, Load balancing, Replication
  Supavisor 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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
