Re: LIKE query on indexes

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: LIKE query on indexes
Дата
Msg-id 1140538679.5777.3.camel@state.g2switchworks.com
обсуждение исходный текст
Ответ на LIKE query on indexes  ("Ibrahim Tekin" <itekin@gmail.com>)
Ответы Re: LIKE query on indexes  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-performance
On Tue, 2006-02-21 at 09:57, Ibrahim Tekin wrote:
> hi,
> i have btree index on a text type field. i want see rows which starts
> with certain characters on that field. so i write a query like this:
>
> SELECT * FROM mytable WHERE myfield LIKE 'john%'
>
> since this condition is from start of the field, query planner should
> use index to find such elements but explain command shows me it will
> do a sequential scan.
>
> is this lack of a feature or i am wrong somewhere?

This is an artifact of how PostgreSQL handles locales other than ASCII.

If you want such a query to use an index, you need to back up your
database, and re-initdb with --locale=C as an argument.  Note that you
then will NOT get locale specific matching and sorting.

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

Предыдущее
От: "Ibrahim Tekin"
Дата:
Сообщение: LIKE query on indexes
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: LIKE query on indexes