Re: How long will the query take - Mailing list pgsql-general

From Andreas Kretschmer
Subject Re: How long will the query take
Date
Msg-id 20100329162424.GA11633@tux
Whole thread Raw
In response to Re: How long will the query take  (Bill Moran <wmoran@potentialtech.com>)
Responses Re: How long will the query take
List pgsql-general
Bill Moran <wmoran@potentialtech.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°

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Splitting text column tomultiple rows
Next
From: "Andrus"
Date:
Subject: How to implement word wrap