| From: | Andreas Kretschmer <akretschmer(at)spamfence(dot)net> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: How long will the query take | 
| Date: | 2010-03-29 16:24:24 | 
| Message-ID: | 20100329162424.GA11633@tux | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Bill Moran <wmoran(at)potentialtech(dot)com> wrote:
> > No, not really. But you can (and should) run EXPLAIN <your query> to
> > obtain the execution plan for that query, und you can show us this plan
> > (and the table-definition for all included tables). Maybe someone is able
> > to tell you what you can do to speed up your query.
> 
> To piggyback on this ... EXPLAIN _is_ the way to know how long your
> query will take, but keep in mind it's only an _estimate_.
> 
> Given that, in my experience EXPLAIN is pretty accurate 90% of the
> time, as long as you analyze frequently enough.
As far as i know, EXPLAIN _can't_ say how long a query will take, it
returns only a COST, not a TIME.
Or can you tell me how long this query will be take?
test=# explain select * from foo;
                      QUERY PLAN
-------------------------------------------------------
 Seq Scan on foo  (cost=0.00..34.00 rows=2400 width=4)
(1 Zeile)
Okay, it's a really little table and a really simple plan ... but
imagine, i have a table with 100 millions rows and a) a slow disk and b)
a fast SSD.
You can't say how long the query will runs, even an estimate, okay?
Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrus | 2010-03-29 16:36:55 | How to implement word wrap | 
| Previous Message | Pavel Stehule | 2010-03-29 16:14:32 | Re: Splitting text column tomultiple rows |