pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: joostje@komputilo.org
Cc: pgsql-sql@postgresql.org
Subject: Re: estimates for nested loop very wrong?
Date: Thu, 10 Apr 2003 12:44:35 -0400
Message-ID: <4867.1049993075@sss.pgh.pa.us> (raw)
In-Reply-To: <20030410162902.GA28537@co.uea.org>
References: <20030410112144.GA22716@co.uea.org>
	<3742.1049984229@sss.pgh.pa.us>
	<20030410162902.GA28537@co.uea.org>

joostje@komputilo.org writes:
> Unless I'm mistaken, pg_nstats.n_distinct should be (aproximately) the same as
> count(distinct(id)), but it obviously isn't. Also the most_common_freqs
> values are about a 100 times higher than in reality, and, even tough about
> 900 values of id occur more often than 40 times, in the 'most_common_vals'
> list are 7 (of the 10) vals that occur less than 40 times, and the real
> top two isn't even represented.

Please try increasing the statistics target (see ALTER TABLE) for db.id, then
re-analyze and see if the estimates get better.  The default setting is
10 --- try 20, 50, 100 to see what happens.

			regards, tom lane




view thread (10+ messages)  latest in thread

Message-ID: <4867.1049993075@sss.pgh.pa.us>
Permalink:  ../4867.1049993075@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4867.1049993075@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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, joostje@komputilo.org
  Subject: Re: estimates for nested loop very wrong?
  In-Reply-To: <4867.1049993075@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