| От | Greg Stark |
|---|---|
| Тема | Re: Like 'name%' is not using index |
| Дата | |
| Msg-id | 877j7cuqfw.fsf@stark.xeocode.com обсуждение исходный текст |
| Ответ на | Like 'name%' is not using index ("Jozsef Szalay" <jszalay@storediq.com>) |
| Список | pgsql-performance |
"Jozsef Szalay" <jszalay@storediq.com> writes: > One would > think that Postgres will use the index to look up the matches, but > apparently that is not the case. It performs a full table scan. My > query looks something like this: > > SELECT * FROM table WHERE name LIKE 'smith%'; There are two possible answers here: First, what does this output on your database? db=> show lc_collate; If it's not "C" then the index can't be used. You would have to make a second special-purpose index specifically for use with LIKE. Secondly, please send "explain analyze" output for your query. It will show if the optimizer is simply estimating that the index won't help enough to be faster than the full table scan. -- greg
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера