regarding IN clause

Поиск
Список
Период
Сортировка
От Surabhi Ahuja
Тема regarding IN clause
Дата
Msg-id CE5C48E227F8ED4990FAC4332100ADC621B534@EVS.iiitb.ac.in
обсуждение исходный текст
Ответы Re: regarding IN clause  (Greg Stark <gsstark@mit.edu>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: What should I do with this: invalid page header in block ... ?
Следующее
От: "Dann Corbit"
Дата:
Сообщение: Re: regarding IN clause