Re: Is it possible to measure IO costs of a query in postgreSQL?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tzahi Fadida <tzahi_ml(at)myrealbox(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is it possible to measure IO costs of a query in postgreSQL?
Date: 2005-01-16 03:43:38
Message-ID: 20050116034338.GA50573@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jan 08, 2005 at 08:01:51PM +0200, Tzahi Fadida wrote:

> I have been trying for a week now without success to discover
> if you can measure the cost of a query (with my c function).
> EXPLAIN ANALYZE seems to give you the actual time it took it
> to run but the "cost" seems to be a fixed estimate number and not
> actual.

"cost" is the planner's estimate of disk page fetches; "actual" is
elapsed real time. See "Using EXPLAIN" in the "Performance Tips"
chapter of the documentation.

> I see in the code many times references to pgstats so
> i figure there must be some kind of accounting.
> Does anyone have a clue on this? its very important to me
> to be able to measure scientifically the costs of a query.

Have you looked at the "The Statistics Collector" section in the
"Monitoring Database Activity" chapter? The statistics views won't
show statistics for a particular query, but if the database is
quiescent except for your activity then you might be able to measure
queries' I/O costs by observing changes in the gathered statistics.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken Tozier 2005-01-16 06:13:58 PostgreSQL and WebObjects
Previous Message Jim C. Nasby 2005-01-16 01:15:02 Re: Index optimization ?