Re: How long will the query take

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How long will the query take
Date: 2010-03-29 16:11:50
Message-ID: 20100329121150.ac2c0a59.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In response to "A. Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>:

> In response to John Gage :
> > I ran a query out of pgAdmin, and (as I expected) it took a long
> > time. In fact, I did not let it finish. I stopped it after a little
> > over an hour.
> >
> > I'm using 8.4.2 on a Mac with a 2.4GHz processor and 2GB of RAM.
> >
> > My question is: is there a way to tell how close the query is to being
> > finished. It would be a great pity if the query would have finished
> > in the 10 seconds after I quit it, but I had no way of telling.
> >
> > As a postscript, I would add that the query was undoubtedly too
> > ambitious. I have a reduced set version which I will run shortly.
> > But I am still curious to know if there is a way to tell how much time
> > is left.
>
> 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.

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2010-03-29 16:12:02 Re: help
Previous Message A. Kretschmer 2010-03-29 16:08:07 Re: How long will the query take