pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedhow to use explain analyze
2+ messages / 2 participants
[nested] [flat]
* how to use explain analyze
@ 2011-10-25 14:12 alan <alan.miller3@gmail.com>
2011-10-26 07:48 ` Re: how to use explain analyze Julius Tuskenis <julius@nsoft.lt>
0 siblings, 1 reply; 2+ messages in thread
From: alan @ 2011-10-25 14:12 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: how to use explain analyze
2011-10-25 14:12 how to use explain analyze alan <alan.miller3@gmail.com>
@ 2011-10-26 07:48 ` Julius Tuskenis <julius@nsoft.lt>
0 siblings, 0 replies; 2+ messages in thread
From: Julius Tuskenis @ 2011-10-26 07:48 UTC (permalink / raw)
To: pgsql-performance
Hello, Alan
On 2011.10.25 17:12, alan wrote:
> 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?
Explain analyze executes the query, so you get the actual execution time
(not always accurate as some extra job must be done while executing the
query to compute the rows and loops).
> I ask because I'm writing a typical web app that allows the user to
> build and submit a query
Be carefull about that idea - especially if a user can write custom
queries like "delete from important_table"
> Thanks,
> Alan
>
--
Julius Tuskenis
Programavimo skyriaus vadovas
UAB nSoft
mob. +37068233050
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-10-26 07:48 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-10-25 14:12 how to use explain analyze alan <alan.miller3@gmail.com>
2011-10-26 07:48 ` Julius Tuskenis <julius@nsoft.lt>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox