| От | Rod Taylor |
|---|---|
| Тема | Re: LIKE and INDEX |
| Дата | |
| Msg-id | 1083778304.60668.3.camel@jester обсуждение исходный текст |
| Ответ на | LIKE and INDEX ("Jie Liang" <jie@stbernard.com>) |
| Список | pgsql-performance |
> but if I use: > select url from urlinfo where url like 'http://%.lycos.de'; > it won't use index at all, NOT good! > is there any way I can force secon query use index??? create index nowww on urlinfo(replace(replace(url, 'http://', ''), 'www.', ''))); SELECT url FROM urlinfo WHERE replace(replace(url, 'http://', ''), 'www.', '') = 'lycos.de' AND url LIKE 'http://%.lycos.de' ; The replace() will narrow the search down to all records containing lycos.de. Feel free to write a more complex alternative for replace() that will deal with more than just optional www. Once the results have been narrowed down, you may use the original like expression to confirm it is your record.
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера