List:Internals« Previous MessageNext Message »
From:Eric Jensen Date:August 1 2009 8:11pm
Subject:Re: why does UNION ALL use a temp table?
View as plain text  
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.

eric

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
> mdcallag@stripped
>
> -- 
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe:    http://lists.mysql.com/internals? 
> unsub=ej@stripped
>

Thread
why does UNION ALL use a temp table?MARK CALLAGHAN1 Aug
  • Re: why does UNION ALL use a temp table?Sergei Golubchik1 Aug
  • Re: why does UNION ALL use a temp table?Eric Jensen1 Aug
    • Re: why does UNION ALL use a temp table?dormando2 Aug