In this recipe, we will be discussing how to analyze the content that resides in PostgreSQL shared buffers.
To analyze the shared buffer contents, PostgreSQL provides an extension called
pg_buffercache, and we also use the
CREATE EXTENSION command. This extension reports the buffer details such as which relation holds the number of buffers in the memory, what buffers are dirty at this moment, and what is a specific buffer's usage count.
In PostgreSQL, shared buffers are not specific to any database as they are managed at cluster level. Hence, while querying the
pg_buffercache we may get relation details that are from other databases too. Also, it is not recommended to query the
pg_buffercache too frequently ...