[MCOL-4584] Significant performance degradation when UNION ALL is used in an outer select, compared to in a subquery. Created: 2021-03-05  Updated: 2022-10-05  Resolved: 2022-06-23

Status: Closed
Project: MariaDB ColumnStore
Component/s: MDB Plugin
Affects Version/s: 5.5.1
Fix Version/s: None

Type: Task Priority: Major
Reporter: Gagan Goel (Inactive) Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: mcs_cs, performance

Issue Links:
Duplicate
duplicates MCOL-4901 Allow pushdown of queries involving U... Closed
Problem/Incident
is caused by MDEV-25080 Allow pushdown of queries involving U... Closed
Relates
relates to MCOL-4569 Queries with UNION ALL perform dispro... Closed
Epic Link: ColumnStore Performance Improvements

 Description   

There appears to be a significant difference in the query execution times between the query Q1:

MariaDB [test]> select count(c1) from wide_table union all select 1;
+-----------+
| count(c1) |
+-----------+
|   1000000 |
|         1 |
+-----------+
2 rows in set (1.941 sec)

And query Q2:

MariaDB [test]> select * from (select count(c1) from wide_table union all select 1) q;
+-----------+
| count(c1) |
+-----------+
|         1 |
|   1000000 |
+-----------+
2 rows in set (0.035 sec)

Here, wide_table is a table with 100 INT columns. As can be seen, Q1 is 60x slower than Q2.

The difference is, Q2 runs using the ColumnStore select handler whereas Q1 does not. Q1's execution path calls mysql_union() in sql/sql_union.cc which currently does not support select handler. This needs to be fixed.



 Comments   
Comment by Gagan Goel (Inactive) [ 2021-03-08 ]

MDEV-25080 has been opened for this issue.

Comment by alexey vorovich (Inactive) [ 2022-06-23 ]

dup to 4901

allen.herrera

Generated at Thu Feb 08 02:51:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.