yoursoft wrote:
> Ok, the planner uses different way. I think the planner use the UNION in
> PreparedStatement and not the UNION ALL?
> How to rewrite the SQL to use the UNION ALL in preparedstatement?
You need an ORDER BY or the order is undefined and unpredictable. See
http://www.postgresql.org/docs/8.2/static/queries-order.html
There's no simple way to say "give me rows from this table first" other
than running a query on each table separately.
-O