Re: Plan differences

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Plan differences
Дата
Msg-id 10594.1451574122@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Plan differences  (Anton Melser <melser.anton@gmail.com>)
Ответы Re: Plan differences
Re: Plan differences
Список pgsql-performance
Anton Melser <melser.anton@gmail.com> writes:
> I moved a DB between two "somewhat" similar Postgres installs and am
> getting much worse plans on the second. The DB was dumped via pg_dump
> (keeping indexes, etc.) and loaded to the new server.

> [ "like 'foo%'" is not getting converted into index bounds ]

I'd bet your old database is in C locale and the new one is not.

The LIKE optimization requires an index that's sorted according to plain
C (strcmp) rules.  A regular text index will be that way only if the
database's LC_COLLATE is C.

If you don't want to rebuild the whole database, you can create indexes to
support this by declaring them with COLLATE "C", or the older way is to
declare them with text_pattern_ops as the index opclass.

            regards, tom lane


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

Предыдущее
От: Anton Melser
Дата:
Сообщение: Re: Plan differences
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Plan differences