Skip to content

Commit

Permalink
MDEV-33742 Do not create group by handler when all tables are constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mariadb-YuchenPei committed Apr 8, 2024
1 parent e865ef6 commit f9e0ebe
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion sql/sql_select.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3367,7 +3367,7 @@ bool JOIN::make_aggr_tables_info()
distinct in the engine, so we do this for all queries, not only
GROUP BY queries.
*/
if (tables_list && top_join_tab_count && !procedure)
if (tables_list && top_join_tab_count && !only_const_tables() && !procedure)
{
/*
At the moment we only support push down for queries where
Expand Down
2 changes: 0 additions & 2 deletions storage/spider/mysql-test/spider/bugfix/r/mdev_19866.result
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `pkey`,`val` from `auto_test_remote`.`tbl_a`
select `pkey`,`val` from `auto_test_remote`.`tbl_a` where `pkey` = 1
select 1 from (select 1) t0
select `pkey`,`val` from `auto_test_remote`.`tbl_a`
select `pkey`,`val` from `auto_test_remote`.`tbl_a`
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
Expand All @@ -86,7 +85,6 @@ argument
select `pkey`,`val` from `auto_test_remote2`.`tbl_a`
select `pkey`,`val` from `auto_test_remote2`.`tbl_a`
select `pkey`,`val` from `auto_test_remote2`.`tbl_a` where `pkey` = 2
select 1 from (select 1) t0
select `pkey`,`val` from `auto_test_remote2`.`tbl_a`
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT pkey, val FROM tbl_a ORDER BY pkey;
Expand Down
2 changes: 0 additions & 2 deletions storage/spider/mysql-test/spider/bugfix/r/mdev_33679.result
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ INSERT INTO t2_spider VALUES(1,1);
SELECT t2_spider.a,t1_spider.c FRoM t2_spider LEFT join t1_spider ON (t2_spider.c = t1_spider.c) WHERE t2_spider.a = 1;
a c
1 1
Warnings:
Warning 1815 Internal error: Spider group by handler: Encountered multiple equalities, likely an optimizer bug
drop table t1, t2, t1_spider, t2_spider;
drop server srv;
for master_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %';
argument
select `value` from `auto_test_remote2`.`tbl_a` where `value` = 5
select `value2` from `auto_test_remote2`.`tbl_b` where `value2` = 5
select sum('5') `sum(a.value)`,count('5') `count(b.value2)` from (select 1) t0 join (select 1) t1
select `value` from `auto_test_remote2`.`tbl_a` where `value` = 5
select `value2` from `auto_test_remote2`.`tbl_b` where `value2` = 5
select sum('5') `sum(a.value)`,count('5') `count(b.value2)` from (select 1) t0 join (select 1) t1
SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'
SELECT value FROM tbl_a ORDER BY value;
value
Expand Down

0 comments on commit f9e0ebe

Please sign in to comment.