Sim Zacks wrote:
I would use 2 left joins and use the where condition to make sure one
of them is true, such as:
select big_table.* from
big_table left join little_table as l1 on big_table.y1=l1.y and
l1.x=10
left join little_table as l2 on big_table.y2=l2.y and l1.x=10
where l1.p_key is not null and l2.p_key is not null
I have never tried this in postgresql, but in my experience with
various other DB engines it is a lot faster then using an or in the
join and faster then a union.
Wow! Thanks! That certainly did the trick.
Mike Mascari
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster