Re: Query with date where clause is very slow

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Mike Christensen <imaudi(at)comcast(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query with date where clause is very slow
Date: 2009-02-20 05:31:26
Message-ID: dcc563d10902192131o2849fbb1ra9c0dad12a5801a7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 19, 2009 at 10:17 PM, Mike Christensen <imaudi(at)comcast(dot)net> wrote:
> I'd tell you, but I lost the database last night <g>
>
> I'll go rebuild the test data but it'll take a while.
>

I assume the data was properly representative of the real data, and
that you were running analyze; before running any queries. Normally
when you see this kind of slow down it's that postgresql picked a bad
query plan because of bad estimates. Most bad estimates can be fixed
with simple increases in the the stats target for the offending
column. Sometimes it takes more than that. Look for numbers of row
estimated versus actual rows returned, and loops.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Christensen 2009-02-20 06:50:52 Question about functions that return a set of records
Previous Message Mike Christensen 2009-02-20 05:17:20 Re: Query with date where clause is very slow