Re: Use index for upper(customername) like 'ABC%'

Поиск
Список
Период
Сортировка
От T.J. Adami
Тема Re: Use index for upper(customername) like 'ABC%'
Дата
Msg-id eaa91b3e-4a9d-42ae-aa13-5f0c0e8c6df8@n77g2000hse.googlegroups.com
обсуждение исходный текст
Ответы Re: Use index for upper(customername) like 'ABC%'
Список pgsql-general
On 4 fev, 18:13, "Andrus" <kobrule...@hot.ee> wrote:
> I need to perform case insensitive search by first some characters (ABC) of
> name like
>
> SELECT ...
> FROM customer
> WHERE upper(customername) like 'ABC%'
>
> My database cluster locale is non-C
> Database encoding is UTF-8
>
> Which index I must create so that this query can use it to speed up data
> retrieval ?
>
> Andrus.

CREATE INDEX ie_cust_upper_name ON customer ( UPPER( customername ) );

If you want to perform better performance for "like 'ABC%'" statement,
you can define it on WHERE clause:

CREATE INDEX ie_cust_upper_name ON customer ( UPPER( customername ) )
WHERE ( UPPER(customername) LIKE 'ABC%' );

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

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: msvcr80.dll and PostgreSQL 8.3 under Windows XP
Следующее
От: "T.J. Adami"
Дата:
Сообщение: Re: Order of SUBSTR and UPPER in statement