Skip to main content

buffer_mapping

Short Description

Waiting to associate a data block with a buffer in the buffer pool.

Additional Information

The server process is waiting for a lightweight lock (LWLock). LWLocks are similar to latches in other database systems. Most such locks protect a particular data structure in shared memory. There is no order to the granting of LWLocks and in a high concurrency system this can cause contention. In order to write the disk block into buffer memory, the buffer cache's hash table entry needs updating. After v9.5, the buffer cache is protected by 128 hash tables each protected by a LWLock. The buffer_mapping LWLock wait event will be seen whilst the buffer mapping is taking place.

How to reduce this wait

  • Ensure you size the buffer cache (shared_buffers) appropriately. This is 128Mb by default but for servers with more than 1GB of memory can be set to between 25% and 40% of physical memory.
  • Consider explicitly setting large or huge memory pages.

PostgreSQL documentation - The Statistics Collector

percona.com blog - postgresql-locking-part-3-lightweight-locks

PostgreSQL documentation - Memory

Search online

If this article doesn't have the information you need you can try searching online. Remember, you can contribute suggestions to this page.