RE: AW: partial index - Mailing list pgsql-hackers

From Zeugswetter Andreas SB SD
Subject RE: AW: partial index
Date
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA41EB370@m0114.s-mxs.net
Whole thread Raw
In response to AW: partial index  ("Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>)
Responses Re: AW: partial index
List pgsql-hackers
> > 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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Question about todo item
Next
From: Tom Lane
Date:
Subject: Re: AW: partial index