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/

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to