0
0
Supabasecloud~20 mins

Connection pooling with PgBouncer in Supabase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PgBouncer Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
How does PgBouncer improve database connection handling?

PgBouncer is used as a connection pooler for PostgreSQL databases. What is the main way PgBouncer improves database connection handling?

AIt encrypts all database traffic to improve security between clients and the database.
BIt reduces the number of active database connections by reusing existing connections for multiple client requests.
CIt automatically scales the database server vertically to handle more connections.
DIt caches query results to speed up repeated queries without hitting the database.
Attempts:
2 left
💡 Hint

Think about how connection pooling helps manage limited database connections efficiently.

Configuration
intermediate
2:00remaining
Identify the correct PgBouncer pool_mode setting for transaction pooling

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?

A"transaction"
B"statement"
C"connection"
D"session"
Attempts:
2 left
💡 Hint

Transaction pooling assigns connections only during transactions, not for the whole session.

Architecture
advanced
2:00remaining
What happens if PgBouncer is configured with pool_mode=statement and a client sends multiple statements in one transaction?

Consider PgBouncer configured with pool_mode=statement. A client sends multiple SQL statements inside a single transaction block. What is the expected behavior?

APgBouncer assigns a new server connection for each statement, potentially breaking transaction integrity.
BPgBouncer holds one server connection for the entire transaction, ensuring all statements run together.
CPgBouncer queues statements and executes them sequentially on a single connection after the transaction ends.
DPgBouncer rejects the transaction because statement pooling does not support transactions.
Attempts:
2 left
💡 Hint

Think about how statement pooling handles connections per statement, not per transaction.

security
advanced
2:00remaining
Which PgBouncer authentication method securely stores user passwords hashed with SCRAM-SHA-256?

PgBouncer supports multiple authentication methods. Which method securely stores user passwords hashed with SCRAM-SHA-256 for authentication?

Aauth_user with MD5 hashed passwords
Bauth_file with plain text passwords
Cauth_query with SCRAM-SHA-256 hashed passwords in the database
Dauth_hba with trust authentication
Attempts:
2 left
💡 Hint

SCRAM-SHA-256 hashes are stored in the database and require querying for authentication.

Best Practice
expert
2:00remaining
What is the recommended PgBouncer pool_mode for a high-concurrency web application with many short queries?

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?

A"session" to keep connections assigned for the whole user session
B"none" to disable pooling and connect directly to the database
C"statement" to assign connections per statement for maximum reuse
D"transaction" to assign connections only during transactions, freeing them between transactions
Attempts:
2 left
💡 Hint

Consider how to maximize connection reuse without breaking transaction boundaries.