Re: [GENERAL] left join with OR optimization

2012-01-24 Thread Tom Lane
Sim Zacks writes: > I've seen written that a b-tree index can't be used on a join with an > OR. That's not the case ... > Is there a way to optimize a join so that it can use an index for a > query such as: > select > a.partid,a.duedate,coalesce(a.quantity,0)+sum(coalesce(b.quantity,0)) > from

Re: [GENERAL] left join with OR optimization

2012-01-24 Thread David Johnston
What version of PostgreSQL? On Jan 24, 2012, at 9:28, Sim Zacks wrote: > I've seen written that a b-tree index can't be used on a join with an > OR. Is there a way to optimize a join so that it can use an index for a > query such as: > > select > a.partid,a.duedate,coalesce(a.quantity,0)+sum(co

[GENERAL] left join with OR optimization

2012-01-24 Thread Sim Zacks
I've seen written that a b-tree index can't be used on a join with an OR. Is there a way to optimize a join so that it can use an index for a query such as: select a.partid,a.duedate,coalesce(a.quantity,0)+sum(coalesce(b.quantity,0)) from stat_allocated_components a left join stat_allocated_compon