See and clear Postgres caches/buffers?

You can see what’s in the PostgreSQL buffer cache using the pg_buffercache module. I’ve done a presentation called “Inside the PostgreSQL Buffer Cache” that explains what you’re seeing, and I show some more complicated queries to help interpret that information that go along with that.

It’s also possible to look at the operating system cache too on some systems, see [pg_osmem.py] for one somewhat rough example.

There’s no way to clear the caches easily. On Linux you can stop the database server and use the drop_caches facility to clear the OS cache; be sure to heed the warning there to run sync first.

Leave a Comment