Installing pg_buffercache into a database
The various parts of pg_buffercache
include a library written in C and some SQL that handles viewing the information. While the buffer cache itself is shared among every database in the cluster, pg_buffercache
only can show you really useful information related to the database you're currently connected to. And its SQL component needs to be installed in each database you want to monitor (but not the templates ones) as well.
In order to install this utility or to use it, you will need to be connected to the database as its superuser. Here's a sample that installs pg_buffercache
into a new database, presuming the RedHat Linux standard directory installation tree; substitute your own PostgreSQL installation directory here:
$ createdb pgbench $ psql -d pgbench -f /usr/share/postgresql/contrib/pg_buffercache.sql SET CREATE FUNCTION CREATE VIEW REVOKE REVOKE
You can confirm that the utility is working as expected by looking at how large...