Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
None
-
None
Description
This was tested in 3 node cluster, with and without shared folders. The problem is that UNION takes far more than the sum of its branches. This is reflect in both elapsed and CPU time consumed by ExeMgr. See consolidated summary in the attachement, as well as an easy reproduction below.
{{
MariaDB [bts]> select count(year) from (select * from flights where year <2018) q;
select count(year) from (select * from flights where year >2018) q;
select count(year) from (select * from flights where year <2018 union all select * from flights where year>2018) q;-------------
count(year) |
-------------
17111358 |
-------------
1 row in set, 1 warning (2.189 sec)
MariaDB [bts]> select count(year) from (select * from flights where year >2018) q;
-------------
count(year) |
-------------
12717658 |
-------------
1 row in set, 1 warning (1.531 sec)
MariaDB [bts]> select count(year) from (select * from flights where year <2018 union all select * from flights where year>2018) q;
-------------
count(year) |
-------------
29829016 |
-------------
1 row in set, 1 warning (11.077 sec)
MariaDB [bts]>
MariaDB [bts]> select calgettrace();
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
calgettrace() |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Desc Mode Table TableOID ReferencedColumns PIO LIO PBE Elapsed Rows
BPS PM flights 3028 (year) 0 6144 3272 10.821 17111358
TNS UM - - - - - - 10.819 17111358
BPS PM flights 3028 (year) 0 3272 6144 8.824 12717658
TNS UM - - - - - - 8.967 12717658
TUS UM - - - - - - 10.781 28241118
TAS UM - - - - - - 10.714 1
TNS UM - - - - - - 0.000 1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 row in set (0.000 sec)
}}
Attachments
Issue Links
- duplicates
-
MCOL-4569 Queries with UNION ALL perform disproportionally badly
- Closed