Re: Inner join on two OR conditions dont use index
Вложения
В списке pgsql-performance по дате отправления:
| От | John A Meinel |
|---|---|
| Тема | Re: Inner join on two OR conditions dont use index |
| Дата | |
| Msg-id | 4294DDAC.1060908@arbash-meinel.com обсуждение исходный текст |
| Ответ на | Inner join on two OR conditions dont use index (Jocelyn Turcotte <turcotte.j@gmail.com>) |
| Ответы |
Re: Inner join on two OR conditions dont use index
|
| Список | pgsql-performance |
Jocelyn Turcotte wrote: >Hi all >i dont know if this is normal, but if yes i would like to know why and >how I could do it another way other than using unions. > > The only thing that *might* work is if you used an index on both keys. So if you did: CREATE INDEX rt_edge_start_end_node ON rt_edge(start_node_id,end_node_id); The reason is that in an "OR" construct, you have to check both for being true. So in the general case where you don't knowthe correlation between the columns, you have to check all of the entries, because even if you know the status of oneside of the OR, you don't know the other. Another possibility would be to try this index: CREATE INDEX rt_edge_stare_or_end ON rt_edge(start_node_id OR end_node_id); I'm not sure how smart the planner can be, though. John =:->
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера