Subselects and Indices - Mailing list pgsql-admin

From Andre Schubert
Subject Subselects and Indices
Date
Msg-id 3C4C1FC3.1EDD1034@kabeljournal.de
Whole thread Raw
List pgsql-admin
Hi,

i have a simple question on indices and subselects.
Lets say i have a table foo with a column id int8 as primary_key bar.
If i do a

select * from foo where id = 10 then the index bar is used.

if i do
select * from foo where id in (10,20) then the index is used.

but if id do
select * from foo where id in ( select 10 ) then the index is not used.

Can anyone explain me this. It is very important, because i have to do
this subselect.

thanks, as

pgsql-admin by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Performance
Next
From: Ferdinand Smit
Date:
Subject: Re: Character problems