PG Install
PG Install
______________________________architecture topics
WAL Buffers: Stores Write-Ahead Log (WAL) records before they are written to disk
(wal_buffers).
Process Description
Postmaster Main parent process; manages startup/shutdown.
Checkpointer Periodically writes dirty buffers to disk.
Background Writer Writes modified buffers to disk to reduce checkpoint load.
WAL Writer Flushes WAL buffers to disk for crash recovery.
Autovacuum Automatically runs VACUUM and ANALYZE to reclaim space.
Stats Collector Gathers statistics for query optimization.
Logger (syslogger) Handles PostgreSQL log files.
Archiver Archives WAL logs if archive_mode = on.
3. PostgreSQL Physical Files
PostgreSQL stores data in the PGDATA directory (default: /var/lib/pgsql/16/data).
Libraries (/usr/pgsql-16/lib/):
TOAST (The Oversized-Attribute Storage Technique): Large values (> 2KB) are
compressed and stored separately.
bash
oid2name -d postgres -U postgres
Example output:
All databases:
Oid Database Name Tablespace
----------------------------------
16384 postgres pg_default
16385 template1 pg_default
5.2 Querying pg_database
sql
SELECT oid, datname FROM pg_database;
Example output:
oid | datname
-------+-----------
16384 | postgres
16385 | template1
16386 | template0
5.3 Listing Tables in a Database
sql
SELECT relname, relfilenode FROM pg_class WHERE relkind = 'r';
relfilenode corresponds to the file name in PGDATA/base/<OID>/.
6. Summary
Memory: Shared buffers, WAL buffers, and process-specific memory optimize
performance.
Further Reading
PostgreSQL 16 Documentation