DEV Community

Ahmad Tashfeen
Ahmad Tashfeen

Posted on

Understanding Process Architecture in PostgreSQL

PostgreSQL is a relational database management system that uses a client/server type architecture with a multi-process approach running on a single host. The PostgreSQL server is a collection of multiple processes that cooperatively manage one database cluster.

Postgres Server Process

A postgres server process, also known as postmaster in earlier versions, is the parent process of all other processes in a PostgreSQL server. It starts up by executing the pg_ctl utility with a start option and allocates a shared memory area in memory, starts various background processes, starts replication associated processes and background worker processes if necessary, and waits for connection requests from clients. Whenever a connection request is received from a client, it starts a backend process.

Backend Processes

A backend process, also called postgres, is started by the postgres server process and handles all queries issued by a connected client. It communicates with the client through a single TCP connection and terminates when the client gets disconnected. PostgreSQL allows multiple clients to connect simultaneously with the configuration parameter max_connections controlling the maximum number of clients.

Background Processes

Various background processes perform processes of each feature (e.g., VACUUM and CHECKPOINT processes) for database management. Replication-associated processes perform streaming replication, and background worker processes can perform any processing implemented by users. It is impossible to explain each function simply as they depend on individual specific features and PostgreSQL internals.

Note: The PostgreSQL server listens to one network port, with the default port being 5432.

Helpful Sources:

https://github.com/apache/age
https://www.interdb.jp/pg/pgsql02.html

Top comments (0)