| От | Thomas Hallgren |
|---|---|
| Тема | Re: Worthwhile optimisation of position()? |
| Дата | |
| Msg-id | 44239289.3010205@tada.se обсуждение исходный текст |
| Ответ на | Worthwhile optimisation of position()? (Christopher Kings-Lynne <chris.kings-lynne@calorieking.com>) |
| Ответы |
Re: Worthwhile optimisation of position()?
|
| Список | pgsql-hackers |
Christopher Kings-Lynne wrote:
> Is it worth allowing this:
>
> select count(*) from users_users where position('ch' in username) = 0;
>
> To be able to use an index, like:
>
> select count(*) from users_users where username like 'ch%';
>
> At the moment the position() syntax will do a seqscan, but the like
> syntax will use an index.
>
You must compare position('ch' in username) to '%ch%' instead of 'ch%' in this respect.
The position function must look for 'ch' everywhere in the string so there's no way it can
use an index.
Regards,
Thomas Hallgren
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера