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

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: counting disk access from index seek operation -- how to?
Date: 2005-09-13 00:16:16
Message-ID: dg4r73$eti$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"huaxin zhang" <uwcssa(at)gmail(dot)com> wrote
>I need a way to tell how many pages loaded from disk for a particular
> index seek operation.

By pages loaded, you mean physically or logically? In either ways, I would
suggest you to take a look at _bt_getbuf().

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

This is not the right place. index_getnext() returns when it find a
satisifed tuple or no match at all. Thus it may access many pages, from the
root of btree down to some leaf node.

> 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))"
>

This functions checks if the real data on the heap matches the information
indicated by the index, since we just save a key and pointer to the real
data on index. Thus, extra IOs may needed.

Regards,
Qingqing

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2005-09-13 07:31:19 Re: Spinlocks, yet again: analysis and proposed patches
Previous Message Tom Lane 2005-09-12 23:22:38 Re: Spinlocks, yet again: analysis and proposed patches