The architecture of Postgresql consists of 3 main components:
- Memory
- Process
- Storage Cluster

Postgresql Instance: It consists of background processes, helper processes, and a
shared buffer area.
The postmaster process manages the instance. An instance can only manage a
database cluster and its databases (Cluster concept is explained in detail in Storage
topic).
More than one instance can run on the same server at the same time, provided that
they are on different TCP ports.
The tasks of instance are Read/write (I/O), provision of ACID conditions, a connection
of client processes, access control, recovery/restore, replication, etc.
When the database is started with or systemctlpg_ctlcluster (pg_cluster), it assigns the memory from the operating system according to the
memory settings in the configuration file, starts the processes, and makes it available
for the clients to access.
When the instance is stopped; root@srv2:~# ps f -upostgres root@srv2:~# top -u postgres PID TTY STAT TIME COMMAND top - 19:19:21 up 6:45, 2 users, load average: 0.00, 0.00, 0.00 Tasks: 75 total, 1 running, 74 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.7 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi,0.0 si, 0.0 st MiB Mem : 1995.4 total, 1601.4 free, 107.2 used, 286.8 buff/cache MiB Swap: 0.0 total, 0.0 free, 0.0 used. 1718.0 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
ps f -upostgres ve top -u postgres
When we check with the above commands, no postgresql processes or postgres users
are listed.
When the Instance is started: # root kullanıcısı ile ya da sudo yetkisi olan bir kullanıcı ile başına “ sudo ” ekleyerek; systemctl start postgresql # logu izleyelim, log dosyasının ismi sizde farklı olabilir “ls-ltr ” ile sıralayıp en güncel olanı kullanabilirsiniz. tail -f /var/log/postgresql/postgresql-13-main.log
While starting, the following logs can be seen.
#Another instance /pg/13.4/bin/pg_ctl -D /pgdata/13.4 -l pg_$DATE.log start postgres@srv2:~$ ps f -upostgres /pg/13.4/bin/postgres -D /pgdata/13.4 _ postgres: checkpointer _ postgres: background writer _ postgres: walwriter _ postgres: autovacuum launcher _ postgres: stats collector _ postgres: logical replication launcher
When we execute ps f -upostgres and top -u postgres again, it lists
the processes that are opened and the instance assigns memory from the operating
system. This shows that the resources have been used.
Postgresql Connections

The daemon process listens for connection requests from clients and creates a server/
backend process for each incoming connection request. When the daemon process is
not running, a connection over the network cannot be made.
When the client sends a connection request, the daemon process fulfills this request
and creates a backend process. After the backend process has been authenticated,
query, data entry/update etc. coming from the client (client) is processed. The backend
process acts as the user’s agent.
These processes are repeated for each incoming connection request and server/
backend processes are created as many as the number of connections, up to themax_connection limit.
Note: Having an extension line between two departments in your office indicates that
the connection exists. Whenever one calls the other and the other party opens and
starts the communication, the session is started.

When users connect to the database, they usually want to read (select) or write
(DML=insert/update/delete) data. Software developers generally need
operations such as adding columns/indexes to the table.
Multiple connections can be made at the same time with the same user.