Re: estimates for nested loop very wrong?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: joostje(at)komputilo(dot)org
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: estimates for nested loop very wrong?
Date: 2003-04-10 16:44:35
Message-ID: 4867.1049993075@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

joostje(at)komputilo(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ian Barwick 2003-04-10 17:35:25 Re: INSERT INTO ... SELECT (PostgreSQL vs. MySQL)
Previous Message joostje 2003-04-10 16:29:02 Re: estimates for nested loop very wrong?