InterviewHubPRO
Section Overview
Q18

Question 18 of 60

Part 2: Relational Databases (RDBMS / PostgreSQL / MySQL) (6 - 25)

30%
Databases & System Design•Part 2: Relational Databases (RDBMS / PostgreSQL / MySQL) (6 - 25)

Database Connection Pooling (PgBouncer):

In Simple Words: Opening database TCP connections is expensive. Connection poolers keep a warm pool of reusable connections, allowing 5,000 app clients to safely share 50 database connections.

sql
-- Monitor active vs idle connections in PostgreSQL:
SELECT state, count(*) 
FROM pg_stat_activity 
GROUP BY state;