PgBouncer is used as a connection pooler for PostgreSQL databases. What is the main way PgBouncer improves database connection handling?
Think about how connection pooling helps manage limited database connections efficiently.
PgBouncer maintains a pool of open connections to the database and reuses them for multiple client requests. This reduces overhead and avoids opening too many connections at once.
PgBouncer supports different pooling modes. Which pool_mode value enables transaction pooling, where a server connection is assigned to a client only during a transaction?
Transaction pooling assigns connections only during transactions, not for the whole session.
The transaction pool_mode assigns a server connection to a client only during the transaction, freeing it afterward for others.
Consider PgBouncer configured with pool_mode=statement. A client sends multiple SQL statements inside a single transaction block. What is the expected behavior?
Think about how statement pooling handles connections per statement, not per transaction.
In statement pooling mode, PgBouncer assigns a server connection per statement, so multiple statements in a transaction may run on different connections, breaking transaction atomicity.
PgBouncer supports multiple authentication methods. Which method securely stores user passwords hashed with SCRAM-SHA-256 for authentication?
SCRAM-SHA-256 hashes are stored in the database and require querying for authentication.
Using auth_query, PgBouncer queries the database to verify SCRAM-SHA-256 hashed passwords securely stored there.
You manage a high-concurrency web app with many short queries per user session. Which PgBouncer pool_mode setting best balances performance and transaction integrity?
Consider how to maximize connection reuse without breaking transaction boundaries.
Transaction pooling assigns connections only during transactions, allowing high reuse while preserving transaction integrity, ideal for many short queries.