There is one row for each buffer in the shared cache. Unused
buffers are shown with all fields null except bufferid. Shared system catalogs are shown
as belonging to database zero.

Because the cache is shared by all the databases, there will
normally be pages from relations not belonging to the current
database. This means that there may not be matching join rows
in pg_class for some rows, or that
there could even be incorrect joins. If you are trying to join
against pg_class, it's a good idea
to restrict the join to rows having reldatabase equal to the current database's
OID or zero.

When the pg_buffercache view is
accessed, internal buffer manager locks are taken for long
enough to copy all the buffer state data that the view will
display. This ensures that the view produces a consistent set
of results, while not blocking normal buffer activity longer
than necessary. Nonetheless there could be some impact on
database performance if this view is read often.