Martijn van Oosterhout sez:
[...]
} Nifty example:
}
} select lower(f) from (select f from a union select f from b);
} (select lower(f) from a) union (select lower(f) from b);
}
} If table a has "HELLO" and table b has "hello", the first will produce two
} rows of output, whereas the second produce only one. To work, you require
} the function to be *invertable* (1-to-1 mapping) which is pretty strict. Off
} the top of my head I'd say the vast majority would fail that test.
}
} UNION ALL would be fine I think, as long as the functions ware cachable and
} there were no aggregates. Basically, as long all you're pushing down is a
} cacheable projection.
As long as you aren't messing with the columns (no projections, no value
modifications, no aggregation), it is $\sigma_p(A) \cup \sigma_p(B)$ vs.
$\sigma_p(A \cup B)$. These are equivalent, regardless of whether it is a
proper UNION or a UNION ALL.
} Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
--Greg