Part 15 / Topic 1 of 7
Process architecture
PostgreSQL is a family of operating-system processes, not threads. The postmaster listens on the port; every connection gets its own backend process; a crew of background workers (checkpointer, autovacuum, WAL writer…) keeps house. Ask your own connection who it is:
SELECT pg_backend_pid() AS my_backend; -- output varies per run
my_backend
------------
81321
(1 row)
That number is a real OS process id — ps would show it. You met the roster in Part 12's deadlock DETAIL ("Process 77495 waits for…"): those were two backends negotiating. Practical consequences of one-process-per-connection: each connection costs real memory (why connection pooling exists — Stage 5B), and one backend crashing can't scribble over another's memory. pg_stat_activity — your Part 12 acquaintance — is simply the live list of these processes.
🧪 Quick quiz — answer from memory, then check.
- What does each client connection get?
- Why do busy applications pool connections?
Show the answers
- Its own backend process, child of the postmaster.
- Processes are expensive to start and hold memory — a pool reuses a few backends for many clients.
Done here? The practice set for Part 15 — 5 exercises with solutions — is on the part page.