Re: 7.4 - FK constraint performance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: ow <oneway_111(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: 7.4 - FK constraint performance
Date: 2004-02-13 00:42:58
Message-ID: 25331.1076632978@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

ow <oneway_111(at)yahoo(dot)com> writes:
> schemaname tablename attname null_frac avg_width n_distinct most_common_vals
> most_common_freqs histogram_bounds correlation
> my large small_id 0 4 10 {7,3,5,1,4,2,8,10,6,9}
> {0.108667,0.105,0.104333,0.101333,0.100667,0.0983333,0.0983333,0.0983333,0.094,0.091}
> 0.0597573

According to this entry, your small_id column only contains the ten
values 1..10, roughly evenly distributed. So why are you probing for
239??

The planner is certainly going to estimate a probe for an unspecified
value as retrieving 10% of the table, and under that assumption it's
quite right to use a seqscan.

If this estimate is not right, perhaps you could give us a more accurate
view of the column statistics?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ow 2004-02-13 01:03:41 Re: 7.4 - FK constraint performance
Previous Message ow 2004-02-13 00:25:48 Re: 7.4 - FK constraint performance

Browse pgsql-sql by date

  From Date Subject
Next Message ow 2004-02-13 01:03:41 Re: 7.4 - FK constraint performance
Previous Message ow 2004-02-13 00:25:48 Re: 7.4 - FK constraint performance