planner not using index for like operator

Поиск
Список
Период
Сортировка
От Sriram Dandapani
Тема planner not using index for like operator
Дата
Msg-id 6992E470F12A444BB787B5C937B9D4DF0406B241@ca-mail1.cis.local
обсуждение исходный текст
Ответы Re: planner not using index for like operator  ("Dave Dutcher" <dave@tridecap.com>)
Re: planner not using index for like operator  ("Jim C. Nasby" <jnasby@pervasive.com>)
Список pgsql-performance

For the query

 

 

Select col1 from table1

Where col1 like ‘172.%’

 

The table has 133 million unique ip addresses. Col1 is indexed.

 

The optimizer is using a sequential scan

 

This is the explain analyze output

 

"Seq Scan on table1 (cost=0.00..2529284.80 rows=1 width=15) (actual time=307591.339..565251.775 rows=524288 loops=1)"

"  Filter: ((col1)::text ~~ '172.%'::text)"

"Total runtime: 565501.873 ms"

 

 

The number of affected rows (500K) is a small fraction of the total row count.

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

Предыдущее
От: "andremachado"
Дата:
Сообщение: Firebird 1.5.3 X Postgresql 8.1.3 (linux and windows)
Следующее
От: PFC
Дата:
Сообщение: Slow queries salad ;)