Skip site navigation (1) Skip section navigation (2)

Re: Selectivity of "=" (Re: [HACKERS] Index not used on simple se lect)

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Zeugswetter Andreas IZ5 <Andreas(dot)Zeugswetter(at)telecom(dot)at>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Selectivity of "=" (Re: [HACKERS] Index not used on simple se lect)
Date: 1999-07-28 15:43:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
> > So, the selectivity that a search for the most common value would
> > have is a reasonable estimate for the selectivity of a search for any
> > value.  That's a bogus assumption in this case --- but it's hard to
> > justify making any other assumption in general.
> > 
> Other db's usually use the value count(*) / nunique for the light weight
> statistics.
> This makes the assumptoin that the distinct index values are evenly
> distributed.
> That is on average a correct assumption, whereas our assumption on average
> overestimates the number of rows returned.
> I am not sure we have a nunique info though.

Yes, that's the problem.  Figuring out the number of uniques is hard,
expecially with no index.

  Bruce Momjian                        |
  maillist(at)candle(dot)pha(dot)pa(dot)us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

In response to

pgsql-hackers by date

Next:From: Bruce MomjianDate: 1999-07-28 15:45:23
Subject: Re: [HACKERS] row reuse while UPDATE and vacuum analyze problem
Previous:From: Bruce MomjianDate: 1999-07-28 15:42:30
Subject: Re: [HACKERS] double opens

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group