BufferContent
Short Description
Waiting to read or write a data page in memory.
Detailed Description​
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 this case a we are waiting for access to a shared memory buffer.
How to reduce this wait​
This is a very common wait as it forms part of any query.
- Check for unused or duplicate indexes and remove if possible and use Partial Indexes if possible.
- Watch out for foreign keys with comparatively few parent rows. The parent rows will have read locks applied whilst child operations take place.
- Consider partitioning the
- Compare with your baseline to see if this is exceptional or normal workload.
- Check for many processes accessing the same resources concurrently.
- Ensure the execution path of your query is efficient as possible.
Additional Links​
PostgreSQL documentation - 27.2. The Statistics Collector
habr.com - Locks in PostgreSQL: 4. Locks in 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.