Commit f9e0ebec authored by Yuchen Pei's avatar Yuchen Pei

MDEV-33742 Do not create group by handler when all tables are constant

parent e865ef6a
......@@ -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
......
......@@ -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 %'
......@@ -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;
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment