Client process or program (frontend): The database frontend application performs a database action. The frontend can be a web server that wants to display a web page or a command-line tool to do maintenance tasks. PostgreSQL provides frontend tools such as psql, createdb, dropdb, and createuser.
Server process (backend): The server process manages database files, accepts connections from client applications, and performs actions on behalf of the client. The server process name is postgres. PostgreSQL forks a new process for each new connection; thus, client and server processes communicate with each other without the intervention of the server main process (postgres), and they have a certain lifetime that is determined by accepting and terminating a client connection.
Postmaster Process: Postmaster process is considered as a super process in PostgreSQL.
The following are the tasks of the Postmaster process.
- Acts as a listener to establish connections.
- start the other background processes during the startup of the cluster.
- Restart the background processes for any kind of termination.
- Does instance recovery after abnormal shutdown.
Background processes: The following are the important background processes that are created by default.
- logger process
- checkpointer process
- writer process
- walwriter process
- autovacuum launcher process
- stats collector process
- bgworker: logical replication launcher
[postgres@postgres04 ~]$ ps -ef | grep postgres
postgres 2215 1 0 18:31 ? 00:00:00 /usr/pgsql-12/bin/postgres -D /u01/pgsql/12
postgres 2216 2215 0 18:31 ? 00:00:00 postgres: logger
postgres 2218 2215 0 18:31 ? 00:00:00 postgres: checkpointer
postgres 2219 2215 0 18:31 ? 00:00:00 postgres: background writer
postgres 2220 2215 0 18:31 ? 00:00:00 postgres: walwriter
postgres 2221 2215 0 18:31 ? 00:00:00 postgres: stats collector
postgres 2222 2215 0 18:31 ? 00:00:00 postgres: logical replication launcher
postgres 2231 2188 0 18:36 pts/0 00:00:00 ps -ef
postgres 2232 2188 0 18:36 pts/0 00:00:00 grep postgres
[postgres@postgres04 ~]$