Re: Confusion about locales and 'like' indexes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Confusion about locales and 'like' indexes
Дата
Msg-id 3457.1109727734@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Confusion about locales and 'like' indexes  (Dan Harris <fbsd@drivefaster.net>)
Список pgsql-performance
Dan Harris <fbsd@drivefaster.net> writes:
> query that uses LIKE.  In my research I have read that the locale
> setting may affect PostgreSQL's choice of seq scan vs index scan.

Non-C-locale indexes can't support LIKE because the sort ordering
isn't necessarily right.

> I am running Fedora Core 2 and it appears when I run "locale" that it
> is set to 'en.US-UTF-8'.

This is not a definitive indication of the environment the database
sees, though.  Try "show lc_collate".

> I can pg_dump and initdb again with --locale=C if
> this will allow my LIKE queries to use indexes, but I just wanted to
> know if there was some other place I needed to change locales in the
> system? e.g. postgresql.conf or env vars?  Or, would the initdb and
> reload alone fix it?

That would do it.  Alternatively you can create special-purpose indexes
with one of the xxx_pattern_ops operator classes to support LIKE.

            regards, tom lane

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

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: multi billion row tables: possible or insane?
Следующее
От: Alan Stange
Дата:
Сообщение: Re: multi billion row tables: possible or insane?