pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: ow <oneway_111@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: 7.4 - FK constraint performance
Date: Thu, 12 Feb 2004 19:42:58 -0500
Message-ID: <25331.1076632978@sss.pgh.pa.us> (raw)
In-Reply-To: <20040213002548.19523.qmail@web60808.mail.yahoo.com>
References: <20040213002548.19523.qmail@web60808.mail.yahoo.com>

ow <oneway_111@yahoo.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



view thread (29+ messages)  latest in thread

Message-ID: <25331.1076632978@sss.pgh.pa.us>
Permalink:  ../25331.1076632978@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25331.1076632978@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, oneway_111@yahoo.com
  Subject: Re: 7.4 - FK constraint performance
  In-Reply-To: <25331.1076632978@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