regarding IN clause - Mailing list pgsql-general

From Surabhi Ahuja
Subject regarding IN clause
Date
Msg-id CE5C48E227F8ED4990FAC4332100ADC621B534@EVS.iiitb.ac.in
Whole thread Raw
Responses Re: regarding IN clause
List pgsql-general

I have a table where the primary key "id" is a serial key.

now i have a query to this table where in, i have to get information related to a set of ids.
This set contains around 130 ids.

I was thinking that i can form a select statement of the form

select * from table where id in(4,8,9,12, and so on....);
i was testing this query on the table with 3000 rows only...
and when i did
explain analyze select * from table where id in(4,8,9,12, and so on....);..
it said that it was doing a sequential scan.

why is it not searching the indexes(index scan)? and how can i make such a query much faster?

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: What should I do with this: invalid page header in block ... ?
Next
From: "Dann Corbit"
Date:
Subject: Re: regarding IN clause