Skip site navigation (1) Skip section navigation (2)

Display Pg buffer cache (WIP)

From: Mark Kirkwood <markir(at)coretech(dot)co(dot)nz>
To: pgsql-patches(at)postgresql(dot)org
Subject: Display Pg buffer cache (WIP)
Date: 2005-03-03 05:36:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
I found it useful to be able to look at what relations are occupying the
cache (mainly for debugging and comparing with page estimates).

I am wondering if it might be a useful addition generally?

How it works a SRF called dump_cache() is created, which is then exposed
as system view pg_dump_cache. So stuff like the following can be
performed (cache of 2000 immediately after 'make installcheck'):

regression=# SELECT c.relname, count(*) AS buffers
regression-# FROM pg_class c, pg_dump_cache d
regression-# WHERE d.relfilenode = c.relfilenode
regression-# GROUP BY c.relname
regression-# ORDER BY 2 DESC LIMIT 10;

                relname             | buffers
    tenk1                           |     345
    tenk2                           |     345
    onek                            |     138
    pg_attribute                    |     102
    road                            |      81
    pg_attribute_relid_attnam_index |      74
    onek2                           |      69
    pg_proc                         |      59
    pg_proc_proname_args_nsp_index  |      56
    hash_f8_heap                    |      49
(10 rows)


As of now the patch breaks 1 regression test (rules - that new view...)
and does not peek into the contents of the buffers themselves (I was
mainly interested in which relations were there), and does not worry too
much about a consistent view of the buffer contents (as I didn't want it
to block all other activity!).

If it seems like a worthwhile addition I will amend the regression
expected and resubmit.

Any comments?


Attachment: pgsql-8.1devel-dumpcache.patch
Description: text/plain (5.1 KB)


pgsql-patches by date

Next:From: Neil ConwayDate: 2005-03-03 07:15:25
Subject: Re: Display Pg buffer cache (WIP)
Previous:From: Bruce MomjianDate: 2005-03-03 05:20:35
Subject: Re: [HACKERS] UTF8 or Unicode

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group