WL#1763: Avoid creating temporary table in UNION ALL

Status: Complete

Currently, union queries always use a temporary table to store the
result before it is returned to the user. This worklog is about
avoiding creating a temporary table for the result of UNION ALL when
there is no need for it, i.e., when there is no top-level ORDER BY.

This will save the cost of creating, writing to and reading from the
temporary table, which may be put on disk if the result is large. This
will also reduce the need for disk space for large unions, and the
client will get the first rows quicker.

Bug#11758470 DO NOT CREATE TEMPORARY TABLES FOR UNION ALL

RB#2651

User Documentation
==================

http://dev.mysql.com/doc/refman/5.7/en/internal-temporary-tables.html
http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-3.html