counting disk access from index seek operation -- how to?

From: huaxin zhang <uwcssa(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: counting disk access from index seek operation -- how to?
Date: 2005-09-12 02:20:52
Message-ID: f2f5625105091119202be1d411@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I need a way to tell how many pages loaded from disk for a particular
index seek operation.

What I did is to set a global flag to true before calling the
following statement
(inside index_getnext() in "/backend/access/indexam.c")

found = DatumGetBool(FunctionCall2(&scan->fn_getnext,
PointerGetDatum(scan),

Int32GetDatum(direction)));

then for each access to disk, I increment a counter until the above call is
finished and set back the global flag.

The number of page IOs is not even matching from what I got from
"select * from pg_stat_all_indexes" --- (is there anything I need to
set in postgresql.conf?)

also, the number of paged IOs for a given index seek is always less
than the total
page loads. Is it because of the statement (following the above in
"/backend/access/indexam.c")?

"if (heap_release_fetch(scan->heapRelation, scan->xs_snapshot,
heapTuple, &scan->xs_cbuf, true,
&scan->xs_pgstat_info))"

If I am running in a single user mode, is there a way to avoid using
extra page IO in
the above statement? It seems to me the extra page IO is caused by
comparing snapshots...

thanks

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-12 02:32:51 Re: -fPIC
Previous Message Greg Stark 2005-09-12 01:21:14 Re: -fPIC