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

Hannu Krosing <hannu@trust.ee>

From: Hannu Krosing <hannu@trust.ee>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Thomas Lockhart <lockhart@alumni.caltech.edu>, Bruce Momjian <maillist@candle.pha.pa.us>, Zeugswetter Andreas IZ5 <Andreas.Zeugswetter@telecom.at>, pgsql-hackers@postgreSQL.org
Date: 1999-07-29T05:42:45Z
Lists: pgsql-hackers
Tom Lane wrote:
> 
> (2) The statistics that we have available are stats about a column.
> Not stats about a column given the predicate of some index.  So there's
> no gain in our statistical knowledge either.

If we added just count of NULLs we would cover for the NOT NULL case

> Partial indexes might be a component of a solution, but they are
> very far from being a solution all by themselves.
> 
>                         regards, tom lane
> 
> PS: a quick glance at gram.y shows that we don't actually accept
> partial-index predicates in CREATE INDEX, so Andreas was right that
> the feature got ripped out at some point.  I have no idea how much
> work might be required to re-enable it... but I'll bet it's not
> trivial.

That's why I suggested getting just the simplest case (NOT NULL) 
working first.

The more general approach would of course be to gather stats by index.

--------------
Hannu