Re: Seeking help with a query that takes too long - Mailing list pgsql-performance

From Tom Lane
Subject Re: Seeking help with a query that takes too long
Date
Msg-id 9083.1068653434@sss.pgh.pa.us
Whole thread Raw
In response to Re: Seeking help with a query that takes too long  ("Nick Fankhauser" <nickf@ontko.com>)
Responses Re: Seeking help with a query that takes too long
List pgsql-performance
"Nick Fankhauser" <nickf@ontko.com> writes:
>> Nick, can you find out why this row count estimation is so far off?

> It's actually correct:

Sure, the 3501 was the "actual".  The estimate was 1 row, which was
pretty far off :-(

> Here are the stats:

It looks like you are running with the default statistics target (10).
Try boosting it to 100 or even more for this column (see ALTER TABLE
SET STATISTICS, then re-ANALYZE) and see if the estimate gets better.
I think the major problem is likely here:
> n_distinct        | 24215
which is no doubt much too small (do you have an idea of the number
of distinct actor_full_name_uppercase values?)

            regards, tom lane

pgsql-performance by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: Value of Quad vs. Dual Processor machine
Next
From: "Marc G. Fournier"
Date:
Subject: Re: *very* slow query to summarize data for a month ...