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

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Hannu Krosing <hannu(at)trust(dot)ee>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ole Gjerde <gjerde(at)icebox(dot)org>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Selectivity of "=" (Re: [HACKERS] Index not used on simple select)
Date: 1999-07-28 00:10:13
Message-ID: 199907280010.UAA20267@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Tom Lane wrote:
> >
> It turns out that the selectivity estimate for an "=" comparison is
> just
> > the attdisbursion statistic calculated by VACUUM ANALYZE, which can be
> > roughly defined as the frequency of the most common value in the column.
> > (I took statistics too long ago to recall the exact definition.)
> > Anyway, given that the test data Ole sent me contains nearly all ''
> > entries, I'd say that the 0.995 value is about right for disbursion.
> >
> > Indeed, if one were to do a "select * from av_parts where nsn = ''",
> > then sequential scan would be the most efficient way to do that.
> > The system has no clue that that's not really something you'd do much.
>
> Does the system currently index NULLs as well ?
>
> I suspect supporting partial indexes (initially just non-NULLs) would
> let us have much better and also use indexes intelligently for
> mostly-NULL
> columns.
>
> Perhaps a line like
>
> * Add partial index support
>
> would fit in TODO
>
> -----------------
> Hannu
>
>

Yes, I think we index nulls. What are partial indexes?

--
Bruce Momjian | http://www.op.net/~candle
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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 1999-07-28 00:13:53 Re: Selectivity of "=" (Re: [HACKERS] Index not used on simple select)
Previous Message The Hermit Hacker 1999-07-27 23:04:58 # of Index' Tuples != Heap'