AdvancedAdvanced PostgreSQL
Theory: Connection Pooling (PgBouncer)
The query
SQL
-- Q: Why is a connection pooler like PgBouncer needed for PostgreSQL?
-- A: PostgreSQL uses a process-based architecture (forks a new OS process
-- for every connection). This consumes significant RAM (~10MB+ per connection).
-- Opening and closing connections is slow.
-- PgBouncer maintains a pool of active connections and multiplexes lightweight
-- client connections over them, preventing memory exhaustion.Note
“MySQL uses a thread-based architecture, making native connection pooling less critical than in PostgreSQL.