"Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com> writes:
> <P><FONT SIZE=3D2>How can I modify this to be more efficient?</FONT>
[Please don't post HTML...]
I think the first question to ask is whether it's even correct. It
looks to me like the EXISTS doesn't depend on the outer query, so
it's effectively a constant, and assuming that the constant is TRUE,
*every* row of db2_pos_fac_rev_02 will be returned.
Also, have you done VACUUM ANALYZE lately? The explain estimates
seem suspiciously low.
regards, tom lane