PostgreSQL has four types of processes:
- The postmaster process: The postmaster process is the first process to begin when you start PostgreSQL. It performs recovery, initializes shared memory, and runs background processes. It also creates a backend process when there is a connection request from the client process.
- The background process: The list of background processes required for PostgreSQL operations can be found in the following table:
Process | Role |
Logger | This writes the error message to the log file. |
Checkpointer | When a checkpoint occurs, the dirty data inside the shared buffer is written to the file. |
Writer | This periodically writes the dirty buffer to a file. |
Wal writer | This writes the WAL buffer to the WAL file. |
Autovacuum launcher |
This launches a new worker process and carries out vacuum operations on bloated tables. |
Archiver | When in Archive.log mode, this copies the WAL file to the specified directory. |
Stats collector | This collects DBMS usage statistics such as session execution information (pg_stat_activity) and table usage statistical information (pg_stat_all_tables). |
Table 1.1 – The background processes of PostgreSQL
- The backend process: The backend process performs the query request of the user process and then transmits the result. Some memory structures are required for query execution; this is called local memory.
- The client process: The client process refers to the background process that is assigned for every backend user connection. Usually, the postmaster process will fork a child process that is dedicated to serving a user connection.