You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#37397306 - looks like not use pruning when it inserts with now()
function in 8.0.
Issue:
All partitions are being retrieved when inserting the now() value
into a non-partition key column in a partition table.
Analysis:
In case of an INSERT query partition pruning takes place in the
prepare stage only. now() was changed from being const to
const_for_execution due to which pruning cannot take place as it
requires all the values in the INSERT to be const.
Fix:
Enable partition pruning to be performed at the execution stage.
Change-Id: I68b7d9d3d880c873a880991d564eca1975900dd0
Note 1003 insert into `test`.`t1` PARTITION (`p0`,`p1`) (`test`.`t1`.`c1`) values ((/* select#2 */ select `test`.`t2`.`c1` from `test`.`t2`))
103
+
Note 1003 insert into `test`.`t1` PARTITION (`p0`,`p1`) (`test`.`t1`.`c1`) values ((/* select#2 */ select `test`.`t2`.`c1` from `test`.`t2` limit 1))
104
104
EXPLAIN
105
105
REPLACE LOW_PRIORITY INTO t1 PARTITION(p0, p1) (c1, c2)
106
106
VALUES (1, 'a'), (2, 'b');
@@ -119,12 +119,12 @@ Warning 3005 REPLACE DELAYED is no longer supported. The statement was converted
119
119
Note 1003 replace into `test`.`t1` PARTITION (`p0`,`p1`) (`test`.`t1`.`c1`,`test`.`t1`.`c2`) /* select#1 */ select `test`.`t2`.`c1` AS `c1`,'a' AS `a` from `test`.`t2`
120
120
EXPLAIN
121
121
REPLACE INTO t1 PARTITION(p0, p1)
122
-
SET c1 = (SELECT c1 from t2);
122
+
SET c1 = (SELECT c1 from t2 LIMIT 1);
123
123
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
0 commit comments