Architecture
PostgreSQL Architecture PostgreSQL follows a client-server architecture with several key components:
Core Components
-
Postmaster: The main PostgreSQL server process that manages connections and spawns backend processes
-
Backend Processes: Individual processes that handle client connections and execute queries
-
Shared Memory: Used for caching data pages, transaction logs, and inter-process communication
-
WAL (Write-Ahead Logging): Ensures data durability and enables point-in-time recovery
Process Architecture
-
Connection Process: Handles client authentication and connection management
-
Background Processes: Autovacuum, checkpointer, WAL writer, and statistics collector
-
Utility Processes: Background writer, archiver, and replication processes
Storage Architecture
-
Data Directory: Contains all database files, configuration files, and logs
-
Tablespaces: Allow storing database objects in different file system locations
-
Pages: Fixed-size blocks (8KB by default) that store table and index data
-
MVCC: Multi-Version Concurrency Control for transaction isolation