List:Internals« Previous MessageNext Message »
From:dormando Date:August 2 2009 12:19am
Subject:Re: why does UNION ALL use a temp table?
View as plain text  
So long as the returned field types aren't going to change, you can
continually concatenate rows onto a streamed resultset. Nothing in the
protocol to stop this, at least...

On Sat, 1 Aug 2009, Eric Jensen wrote:

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