PostgreSQL has two kinds of memory locations to store data: the shared memory area, and local memory area.
Shared Memory Area
The shared memory area is used by all processes of a postgreSQL server. It is allocated when the server is started.
The shared memory area can be divided into sub-areas based on their function. The main sub-areas are described below:
- Shared pool buffer: this is where postgres loads pages and operates on them.
- WAL buffer: this is where WAL data is stored before being written to permanent storage.
- Commit log: stores the states of all transactions.
- Checkpointer
- Autovacuum
- Sub-areas for semaphores and locks for concurrency control.
Local Memory Area
This is unique to each backend process. It is used for query processing. It has 3 major sub-areas:
- work_mem: this area is used for sorting tuples by the ORDER BY and DISTINCT operations.
- maintenance_work_mem: used for maintenance operations.
- temp_buffers: used for storing temporary tables.
Top comments (0)