pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: nickf@ontko.com
Cc: Manfred Koizar <mkoi-pg@aon.at>
Cc: Pgsql-Performance@Postgresql. Org <pgsql-performance@postgresql.org>
Subject: Re: Seeking help with a query that takes too long
Date: Wed, 12 Nov 2003 11:10:34 -0500
Message-ID: <9083.1068653434@sss.pgh.pa.us> (raw)
In-Reply-To: <NEBBLAAHGLEEPCGOBHDGKEJFJGAA.nickf@ontko.com>
References: <NEBBLAAHGLEEPCGOBHDGKEJFJGAA.nickf@ontko.com>

"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



view thread (11+ messages)  latest in thread

Message-ID: <9083.1068653434@sss.pgh.pa.us>
Permalink:  ../9083.1068653434@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9083.1068653434@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nickf@ontko.com, mkoi-pg@aon.at
  Subject: Re: Seeking help with a query that takes too long
  In-Reply-To: <9083.1068653434@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox