most likely because you can manipulate the results of the union (e.g.
by giving it its own ORDER BY). for simple versions though this
should certainly be possible. i'm not sure how easy it is to
concatenate two result sets w/o unifying them in a temp table...i know
some of the logic for the unification of schemas, for example, is done
around the creation of the temporary table.
On Aug 1, 2009, at 8:41 AM, MARK CALLAGHAN wrote:
> Why does UNION ALL always use a temp table? It would be more
> efficient to send the result from each branch of a UNION ALL directly
> to the network rather than buffering it in a temp table first until
> all branches have been evaluated. Some apps use UNION ALL to improve
> performance by reducing round trips between the app and the server,
> but the use of a temp table in MySQL reduces the benefit of that.
> Mark Callaghan
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe: http://lists.mysql.com/internals?