Curt Sampson <cjs(at)cynic(dot)net> writes:
> But for some reason this view doesn't use the indices that an
> equivalant query uses:
You're essentially supposing that
select * from (select * from a union select * from b) where foo;
may be transformed into
(select * from a where foo) union (select * from b where foo);
I don't doubt that this transformation is valid in some cases ... but
I do doubt that it is valid in all cases. If someone can supply a
rigorous proof about when it is valid, I'd be willing to look into
doing the necessary programming.
regards, tom lane