Home / Companies / Neon / Blog / Post Details
Content Deep Dive

PgBouncer: The one with prepared statements

Blog post from Neon

Post Details
Company
Date Published
Author
Raouf Chebri
Word Count
1,076
Language
English
Hacker News Points
-
Summary

Neon has announced support for PgBouncer 1.22.0, a lightweight connection pooler that helps manage and maintain database connections to address Postgres' connection limitations. This release enhances query throughput significantly and includes support for protocol-level prepared statements. Prepared statements in Postgres allow SQL queries to be optimized for repeated executions, improving performance and security by reducing the risk of SQL injection attacks. Although the SQL-level prepared statements using PREPARE and EXECUTE aren't directly compatible with PgBouncer, client libraries can still utilize prepared statements with pooled connections. PgBouncer manages prepared statements by assigning internal names and rewriting commands before forwarding them to Postgres, which allows for efficient query execution. This integration enables users to leverage the benefits of prepared statements alongside PgBouncer's connection pooling capabilities, facilitating higher concurrency in modern applications.