PostgreSQL Cluster / Instance is combination of Memory and Background process, cluster is nothing but collection / Group of databases managed by single instance of the PostgreSQL cluster
Memory Components
Shared Memory
Shared Buffer ==> This is the primary cache of PostgreSQL, where data blocks writes/reads from the disk.
WAL Buffer ==> Buffer for Write ahead logging (WAL) data before it is written to disk.
CLOG Buffer ==> Store commit log information to manage transaction states
Temp Buffers ==> Used for storing temporary tables. Default 8MB
Work Memory ==> Used for sorting operations , Bitmap operation, hash join and merge join operations. Default 4MB
Maintenance Work Memory ==> Used for vacuum and index operations. Default 64MB
Catalog Cache and Execution Memory ==> Memory used for caching system catalogs and executing SQL queries
Backend Process
Postmaster Process
When we start PostgreSQL cluster ,the postmaster process is the first to initialize
Responsibilities of Postmaster
Accepting incoming connection
Forks new backend process
Starts background process
Handles server restart and crash recovery
BG Writer ==> Periodically Writes Dirty buffers/pages from shared buffer to the disk
WAL Writer ==> Writes contents of the WAL buffers to WAL files
Checkpoint ==> Writes dirty buffers to disk when a checkpoint occurs , this reduces the recovery time after a crash.
Stats Collector ==> Collect DBMS usage statistics information such as session activity information(pg_stat_activity) and table usage statistics information (pg_stat_all_tables)
Gathers and maintains statistical data about the database, which the query planner uses to optimize query execution plans
Archiver ==> When in archive log mode , copies the WAL files to the archive log location
Sys Logger ==> Logs error messages and a variety of information to log files
Auto vacuum Launcher ==> Fork the auto vacuum worker when vacuum is required(Automatically reclaims storage occupied by dead tuples( Rows that have updated or deleted), to prevent table bloat and maintains query performance.
Logical Replication Launcher ==> Manages the logical replication workers that handle replication of changes to other databases.
WAL Sender ==> Sending WAL records to standby servers, runs on the primary server
WAL Receiver ==> Receive WAL records and apply on standby server , runs on the standby server
No comments:
Post a Comment