Index called with Union but not with OR clause

Поиск
Список
Период
Сортировка
От V Chitra
Тема Index called with Union but not with OR clause
Дата
Msg-id 008401c3f77e$a78f1d20$18dda8c0@VICHITRA
обсуждение исходный текст
Ответы Re: Index called with Union but not with OR clause  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-admin
Hi All,
 
I have a select statement 
 
select * from v_func_actual_costs
where parent_project='10478' or proj_pk = '10478'
 
both the fields parent_project and proj_pk have indexes based on them, but when I ran explain plan on this statement I found that none of the indexes are being called. But, if I make two separate statement and combine them with Union ALL, the indexes are being called. The select statement in this case is
 
select * from ct_admin.v_func_actual_costs
where parent_project='10478'
union all
select * from ct_admin.v_func_actual_costs
where proj_pk = '10478'
 
Can anybody help me to find a reason for the same. This is just a part of the query so I cannot use the Union ALL clause.
 
Thanks in advance

Chitra

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

Предыдущее
От: "www.mg.te.ua"
Дата:
Сообщение: problems with regressive tests on rh8.0
Следующее
От: Andrew Kornilov
Дата:
Сообщение: problems with regressive tests on rh8.0