Shared memory refers to the memory that is reserved for database caching and transaction log caching. The most important elements in shared memory are shared buffers and WAL buffers:
- Shared buffers: The purpose of a shared buffer is to minimize DISK I/O. For this purpose, the following principles must be met:
- You need to access very large buffers (that is, tens or hundreds of gigabytes worth) quickly.
- You should minimize contention when many users access it at the same time.
- Frequently used blocks must remain in the buffer for as long as possible.
- WAL buffers: The WAL buffer is a buffer that temporarily stores changes to the database:
- The contents stored in the WAL buffer are written to the WAL file at a predetermined point in time.
- From a backup and recovery point of view, WAL buffers and WAL files are very important.