how to use explain analyze

From: alan <alan(dot)miller3(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: how to use explain analyze
Date: 2011-10-25 14:12:55
Message-ID: 8f370776-9394-46ad-b712-ceceaf02b279@hj4g2000vbb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I'm new to postgres and was wondering how to use EXPLAIN ANALYZE ....

Can I use the output from ANALYZE EXPLAIN to estimate or predict the
actual time
it would take for a given query to return?

I ask because I'm writing a typical web app that allows the user to
build and submit a query
to my DB. Since I don't know how "simple" or "complex" the user-
generated queries will be
I thought it might be possible to use the ANALYZE EXPLAIN output to
make a "guestimation"
about the expected return time of the query.

I'd like to use this in my web-app to determine whether to run the
query in real-time (user waits
for results) or queue up the query (and notify the user once the query
is finished). E.g.:
if (the Total runtime" reported by explain analyze is > n ms) {
tell the user that his request was submitted for processing, and
notify the user once resuilts are available
} else {
run the query and wait for the results in real time.
}

Thanks,
Alan

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Claudio Freire 2011-10-25 14:55:02 Re: Choosing between Intel 320, Intel 510 or OCZ Vertex 3 SSD for db server
Previous Message Cezariusz Marek 2011-10-25 13:07:44 sub