index not being used

Поиск
Список
Период
Сортировка
От Reynard Hilman
Тема index not being used
Дата
Msg-id 3DFB97F9.8050801@lightsky.com
обсуждение исходный текст
Ответы Re: index not being used  (Doug Fields <dfields-pg-general@pexicom.com>)
Список pgsql-general
I'm having problem where index is not being used in query on very big
table (10 million rows), even after I set the enable_seqscan=off and
enable_indexscan=on. The query always choose seq scan when I do EXPLAIN.
This causes the query to take about 25 seconds to execute.
However, if the table only has 1 million rows, the query chooses the
index scan and only take about 80 msec.

here is the table structure:
create table test_10million (
id   int8,
app_id  int8
);

< fill the table with 10 million record >

create index test_10million_id on test_10million (id);

this query always uses sequential scan:
select * from test_10million where id = 123 and app_id = 100;

Does the number of rows matter here? (is 10 million too big for the
index table?).

thanks,
- reynard



В списке pgsql-general по дате отправления:

Предыдущее
От: Egyud Csaba
Дата:
Сообщение: Re: Where are my tables physically in the fs?
Следующее
От: Doug Fields
Дата:
Сообщение: Re: index not being used