Re: Is it possible to measure IO costs of a query in postgreSQL? - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Is it possible to measure IO costs of a query in postgreSQL?
Date
Msg-id 20050116034338.GA50573@winnie.fuhr.org
Whole thread Raw
In response to Is it possible to measure IO costs of a query in postgreSQL?  (Tzahi Fadida <tzahi_ml@myrealbox.com>)
Responses Re: Is it possible to measure IO costs of a query in
List 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/

pgsql-general by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Index optimization ?
Next
From: Ken Tozier
Date:
Subject: PostgreSQL and WebObjects