> > test=# create index myindex on accounts(aid) where bid <> 0;
>
> > Hmm ? Am I reading correctly ? a restriction that is on a field,
that
> > is not in the index ? Does that make sense ?
>
> Yes it does, and in fact it's one of the more important applications
of
> partial indexes. It's the only way that a partial index can be
cheaper
> to scan than a full index.
Ok, yes, sounds great, but then back to Tatsuo's question:
Why is the index atestpartial not used (instead DEBUG) ?
create table atest (aid int, bid int);create index atestpartial on atest (aid) where bid <> 0;select * from atest where
aid=1and bid <> 0;
and instead seq scan for 1 mio rows 2 rows where bid <> 0
Since bid is not in an index the evaluation of usability obviously
should not be based on index ops ?
Andreas