Re: SQL optimization - WHERE SomeField STARTING WITH ...

Поиск
Список
Период
Сортировка
От Tino Wildenhain
Тема Re: SQL optimization - WHERE SomeField STARTING WITH ...
Дата
Msg-id 48B6FC24.4070808@wildenhain.de
обсуждение исходный текст
Ответ на SQL optimization - WHERE SomeField STARTING WITH ...  (Bill <pg@dbginc.com>)
Ответы Re: SQL optimization - WHERE SomeField STARTING WITH ...  (Steve Atkins <steve@blighty.com>)
Re: SQL optimization - WHERE SomeField STARTING WITH ...  (Bill <pg@dbginc.com>)
Список pgsql-general
Hi Bill,

Bill wrote:
> The SQL database servers I have worked with cannot use and index for a
> SELECT of the form
>
> SELECT * FROM ATABLE
> WHERE AFIELD LIKE ?
>
> because there is no way to know the location of the wild card until the
> parameter value is known. InterBase and Firebird allow
>
> SELECT * FROM ATABLE
> WHERE AFIELD STARTING WITH ?
>
> which is equivalent to LIKE  'ABC%' and will use an index on AFIELD. Is
> there a similar syntax in PostgreSQL?

Yes, its actually: LIKE 'ABC%' and it will use an index.

Regards
Tino

Вложения

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

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: temp schemas
Следующее
От: "John T. Dow"
Дата:
Сообщение: Re: WAL file questions - how to relocate on Windows, how to replay after total loss, etc