Re: index not used if using IN or OR

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: index not used if using IN or OR
Дата
Msg-id 25181.1099579923@sss.pgh.pa.us
обсуждение исходный текст
Ответ на index not used if using IN or OR  (Mario Ivankovits <mario@ops.co.at>)
Список pgsql-performance
Mario Ivankovits <mario@ops.co.at> writes:
> After populating the table with 8920 records and "analyze" the scenario
> gets even worser:

> select * from tt where seckey = 1;
> Seq Scan on tt  (cost=0.00..168.50 rows=1669 width=12) (actual
> time=0.000..15.000 rows=1784 loops=1)
>   Filter: (seckey = 1)
> Total runtime: 31.000 ms

> Now also this simple query uses a "Seq Scan".

Which is exactly what it *should* do, considering that it is selecting
1784 out of 8920 records.  Indexscans only win for small selectivities
--- the rule of thumb is that retrieving more than about 1% of the
records should use a seqscan.

            regards, tom lane

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

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: preloading indexes
Следующее
От: Martin Foster
Дата:
Сообщение: Re: Restricting Postgres