I have two datasets, one dataset has millions of data, one dataset has only a few pieces of data, now the two datasets will be datamatized by UNION ALL ,we find that this query will be very slow, if we will unite the two datasets after REBALANCE ,the query will become very efficient, but this kind of query in the official document did not find the relevant But this query is not documented in the official documentation.
select * from tableA
union all
select * from tableB
tableA —– million data
tableB —– 10 pieces of data
This query takes about half an hour to produce results
SELECT * FROM (
select * from tableA
UNION ALL
select * from tableB
) REBALANCE
tableA ----- millio
n
data
tableB—– 10 pieces of data
This query produces results in about a second
Where can I see the documentation that explains
The execution of the two queries is almost the same
user26334576 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.