col1 ILIKE 'foo%' not behaving the same as lower(col1) LIKE 'foo%'

Поиск
Список
Период
Сортировка
От milos d
Тема col1 ILIKE 'foo%' not behaving the same as lower(col1) LIKE 'foo%'
Дата
Msg-id COL115-W810E7D489AB499923CA917D5BB0@phx.gbl
обсуждение исходный текст
Ответы Re: col1 ILIKE 'foo%' not behaving the same as lower(col1) LIKE 'foo%'  (Richard Huxton <dev@archonet.com>)
Список pgsql-performance
Hello,

I have a table 'foo_bar' with a column 'col1' defined as 'col1 varchar(512)'. This column is indexed using an expression index defined as

CREATE INDEX ix_foo_bar_by_col1 ON foo_bar(lower(col1) col1 varchar_pattern_ops)

The problem is when I try matching using ILIKE, (col1 ILIKE 'foo%')  PostgreSQL does not use an index scan but a Seq scan of the whole table, but when I try (lower(col1) LIKE 'foo%') PostgreSQL uses an index scan.

Could this be a bug with ILIKE or am I missing something?

The table has ~ 4 million rows.
PostgreSQL 8.3.5 on Windows Vista, non C locale, DB encoding is LATIN1.

Thank you in advance,
Milos.

Combine your email accounts here! Want to marry your mail?

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

Предыдущее
От: Guillaume Cottenceau
Дата:
Сообщение: Re: scheduling autovacuum at lean hours only.
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: col1 ILIKE 'foo%' not behaving the same as lower(col1) LIKE 'foo%'