Re: Seeking help with a query that takes too long

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: nickf(at)ontko(dot)com
Cc: "Manfred Koizar" <mkoi-pg(at)aon(dot)at>, "Pgsql-Performance(at)Postgresql(dot) Org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Seeking help with a query that takes too long
Date: 2003-11-12 16:10:34
Message-ID: 9083.1068653434@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Nick Fankhauser" <nickf(at)ontko(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Nick Fankhauser 2003-11-12 16:52:51 Re: Seeking help with a query that takes too long
Previous Message Marc G. Fournier 2003-11-12 16:08:56 Re: *very* slow query to summarize data for a month ...