Merge lp:~roccoblues/drizzle/port-constants-evalutation-fixes into lp:~drizzle-trunk/drizzle/development

Proposed by Dennis Schön
Status: Merged
Merged at revision: not available
Proposed branch: lp:~roccoblues/drizzle/port-constants-evalutation-fixes
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 408 lines (+181/-11)
18 files modified
drizzled/item.cc (+59/-0)
drizzled/item.h (+3/-0)
drizzled/item/cache.h (+4/-0)
drizzled/item/ref.h (+4/-1)
drizzled/join.cc (+38/-0)
drizzled/join.h (+2/-0)
tests/r/errors.result (+4/-1)
tests/r/func_in.result (+0/-1)
tests/r/func_like.result (+1/-1)
tests/r/func_str.result (+1/-1)
tests/r/func_time.result (+0/-1)
tests/r/select.result (+43/-0)
tests/r/subselect.result (+1/-1)
tests/r/subselect_no_mat.result (+1/-1)
tests/r/subselect_no_mat_and_semi_join.result (+1/-1)
tests/r/subselect_no_opts.result (+1/-1)
tests/r/subselect_no_semijoin.result (+1/-1)
tests/t/select.test (+17/-0)
To merge this branch: bzr merge lp:~roccoblues/drizzle/port-constants-evalutation-fixes
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Review via email: mp+16242@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dennis Schön (roccoblues) wrote :

This ports the fixes for MySQL Bug#33546 to drizzle. Test-suite passes.

One small thing I've noticed is that in the test result file this query

EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;

leads to different results in drizzle and mysql:

MySQL:
EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
 1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
Warnings:
Note 1003 select '2' AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t1` where 1

Drizzle:
EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
Warnings:
Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t2` left join `test`.`t1` on((`test`.`t1`.`a` = (`test`.`t2`.`b` + 1))) where 1

I don't think that's because of my changes but please double check. Jay said on IRC: "might be some constant propogation in the optimizer that is not in Drizzle. I wouldn't worry about it too much. The case that is being optimized is pretty minimal."

Revision history for this message
Jay Pipes (jaypipes) wrote :

Looks good. I downloaded and all tests pass. Approved from me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/item.cc'
--- drizzled/item.cc 2009-12-05 23:29:59 +0000
+++ drizzled/item.cc 2009-12-16 14:56:20 +0000
@@ -1272,6 +1272,65 @@
1272 return error;1272 return error;
1273}1273}
12741274
1275/**
1276 Check if an item is a constant one and can be cached.
1277
1278 @param arg [out] TRUE <=> Cache this item.
1279
1280 @return TRUE Go deeper in item tree.
1281 @return FALSE Don't go deeper in item tree.
1282*/
1283
1284bool Item::cache_const_expr_analyzer(unsigned char **arg)
1285{
1286 bool *cache_flag= (bool*)*arg;
1287 if (!*cache_flag)
1288 {
1289 Item *item= real_item();
1290 /*
1291 Cache constant items unless it's a basic constant, constant field or
1292 a subselect (they use their own cache).
1293 */
1294 if (const_item() &&
1295 !(item->basic_const_item() || item->type() == Item::FIELD_ITEM ||
1296 item->type() == SUBSELECT_ITEM ||
1297 /*
1298 Do not cache GET_USER_VAR() function as its const_item() may
1299 return TRUE for the current thread but it still may change
1300 during the execution.
1301 */
1302 (item->type() == Item::FUNC_ITEM &&
1303 ((Item_func*)item)->functype() == Item_func::GUSERVAR_FUNC)))
1304 *cache_flag= true;
1305 return true;
1306 }
1307 return false;
1308}
1309
1310/**
1311 Cache item if needed.
1312
1313 @param arg TRUE <=> Cache this item.
1314
1315 @return cache if cache needed.
1316 @return this otherwise.
1317*/
1318
1319Item* Item::cache_const_expr_transformer(unsigned char *arg)
1320{
1321 if (*(bool*)arg)
1322 {
1323 *((bool*)arg)= false;
1324 Item_cache *cache= Item_cache::get_cache(this);
1325 if (!cache)
1326 return NULL;
1327 cache->setup(this);
1328 cache->store(this);
1329 return cache;
1330 }
1331 return this;
1332}
1333
1275bool Item::send(plugin::Client *client, String *buffer)1334bool Item::send(plugin::Client *client, String *buffer)
1276{1335{
1277 bool result= false;1336 bool result= false;
12781337
=== modified file 'drizzled/item.h'
--- drizzled/item.h 2009-12-05 20:06:30 +0000
+++ drizzled/item.h 2009-12-16 14:56:20 +0000
@@ -684,6 +684,9 @@
684 virtual bool register_field_in_read_map(unsigned char *arg);684 virtual bool register_field_in_read_map(unsigned char *arg);
685 virtual bool subst_argument_checker(unsigned char **arg);685 virtual bool subst_argument_checker(unsigned char **arg);
686686
687 virtual bool cache_const_expr_analyzer(unsigned char **arg);
688 virtual Item* cache_const_expr_transformer(unsigned char *arg);
689
687 virtual Item *equal_fields_propagator(unsigned char * arg);690 virtual Item *equal_fields_propagator(unsigned char * arg);
688 virtual bool set_no_const_sub(unsigned char *arg);691 virtual bool set_no_const_sub(unsigned char *arg);
689 virtual Item *replace_equal_field(unsigned char * arg);692 virtual Item *replace_equal_field(unsigned char * arg);
690693
=== modified file 'drizzled/item/cache.h'
--- drizzled/item/cache.h 2009-12-04 23:47:14 +0000
+++ drizzled/item/cache.h 2009-12-16 14:56:20 +0000
@@ -78,6 +78,10 @@
78 {78 {
79 return this == item;79 return this == item;
80 }80 }
81 bool basic_const_item() const
82 {
83 return test(example && example->basic_const_item());
84 }
81};85};
8286
83#endif /* DRIZZLED_ITEM_CACHE_H */87#endif /* DRIZZLED_ITEM_CACHE_H */
8488
=== modified file 'drizzled/item/ref.h'
--- drizzled/item/ref.h 2009-12-05 23:13:49 +0000
+++ drizzled/item/ref.h 2009-12-16 14:56:20 +0000
@@ -146,7 +146,10 @@
146 if (ref && result_type() == ROW_RESULT)146 if (ref && result_type() == ROW_RESULT)
147 (*ref)->bring_value();147 (*ref)->bring_value();
148 }148 }
149149 bool basic_const_item() const
150 {
151 return (*ref)->basic_const_item();
152 }
150};153};
151154
152#endif /* DRIZZLED_ITEM_REF_H */155#endif /* DRIZZLED_ITEM_REF_H */
153156
=== modified file 'drizzled/join.cc'
--- drizzled/join.cc 2009-12-07 19:18:46 +0000
+++ drizzled/join.cc 2009-12-16 14:56:20 +0000
@@ -621,6 +621,7 @@
621 {621 {
622 conds=new Item_int((int64_t) 0,1); // Always false622 conds=new Item_int((int64_t) 0,1); // Always false
623 }623 }
624
624 if (make_join_select(this, select, conds))625 if (make_join_select(this, select, conds))
625 {626 {
626 zero_result_cause=627 zero_result_cause=
@@ -828,6 +829,9 @@
828 if (setup_subquery_materialization())829 if (setup_subquery_materialization())
829 return 1;830 return 1;
830831
832 /* Cache constant expressions in WHERE, HAVING, ON clauses. */
833 cache_const_exprs();
834
831 /*835 /*
832 is this simple IN subquery?836 is this simple IN subquery?
833 */837 */
@@ -2379,6 +2383,40 @@
2379}2383}
23802384
2381/**2385/**
2386 Cache constant expressions in WHERE, HAVING, ON conditions.
2387*/
2388
2389void JOIN::cache_const_exprs()
2390{
2391 bool cache_flag= false;
2392 bool *analyzer_arg= &cache_flag;
2393
2394 /* No need in cache if all tables are constant. */
2395 if (const_tables == tables)
2396 return;
2397
2398 if (conds)
2399 conds->compile(&Item::cache_const_expr_analyzer, (unsigned char **)&analyzer_arg,
2400 &Item::cache_const_expr_transformer, (unsigned char *)&cache_flag);
2401 cache_flag= false;
2402 if (having)
2403 having->compile(&Item::cache_const_expr_analyzer, (unsigned char **)&analyzer_arg,
2404 &Item::cache_const_expr_transformer, (unsigned char *)&cache_flag);
2405
2406 for (JoinTable *tab= join_tab + const_tables; tab < join_tab + tables ; tab++)
2407 {
2408 if (*tab->on_expr_ref)
2409 {
2410 cache_flag= false;
2411 (*tab->on_expr_ref)->compile(&Item::cache_const_expr_analyzer,
2412 (unsigned char **)&analyzer_arg,
2413 &Item::cache_const_expr_transformer,
2414 (unsigned char *)&cache_flag);
2415 }
2416 }
2417}
2418
2419/**
2382 @brief2420 @brief
2383 2421
2384 Process one record of the nested loop join.2422 Process one record of the nested loop join.
23852423
=== modified file 'drizzled/join.h'
--- drizzled/join.h 2009-12-07 19:18:46 +0000
+++ drizzled/join.h 2009-12-16 14:56:20 +0000
@@ -472,6 +472,8 @@
472 sizeof(drizzled::optimizer::Position) * size);472 sizeof(drizzled::optimizer::Position) * size);
473 }473 }
474474
475 void cache_const_exprs();
476
475 /**477 /**
476 * @param[in] index the index of the position to retrieve478 * @param[in] index the index of the position to retrieve
477 * @return a reference to the specified position in the optimal479 * @return a reference to the specified position in the optimal
478480
=== modified file 'tests/r/errors.result'
--- tests/r/errors.result 2008-12-16 07:07:50 +0000
+++ tests/r/errors.result 2009-12-16 14:56:20 +0000
@@ -30,17 +30,20 @@
30CREATE TABLE t1 (a INT);30CREATE TABLE t1 (a INT);
31SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));31SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
32a32a
33Warnings:
34Error 1365 Division by 0
33INSERT INTO t1 VALUES(1);35INSERT INTO t1 VALUES(1);
34SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));36SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
35a37a
361381
39Warnings:
40Error 1365 Division by 0
37INSERT INTO t1 VALUES(2),(3);41INSERT INTO t1 VALUES(2),(3);
38SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));42SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0)));
39a43a
401441
41Warnings:45Warnings:
42Error 1365 Division by 046Error 1365 Division by 0
43Error 1365 Division by 0
44DROP TABLE t1;47DROP TABLE t1;
45CREATE TABLE t1( a INT );48CREATE TABLE t1( a INT );
46SELECT b FROM t1;49SELECT b FROM t1;
4750
=== modified file 'tests/r/func_in.result'
--- tests/r/func_in.result 2009-07-27 23:00:57 +0000
+++ tests/r/func_in.result 2009-12-16 14:56:20 +0000
@@ -460,7 +460,6 @@
460id460id
461Warnings:461Warnings:
462Error 1365 Division by 0462Error 1365 Division by 0
463Error 1365 Division by 0
464DROP TABLE t1;463DROP TABLE t1;
465End of 5.0 tests464End of 5.0 tests
466create TEMPORARY table t1(f1 char(1)) ENGINE=MYISAM;465create TEMPORARY table t1(f1 char(1)) ENGINE=MYISAM;
467466
=== modified file 'tests/r/func_like.result'
--- tests/r/func_like.result 2008-12-06 22:41:03 +0000
+++ tests/r/func_like.result 2009-12-16 14:56:20 +0000
@@ -10,7 +10,7 @@
10id select_type table type possible_keys key key_len ref rows filtered Extra10id select_type table type possible_keys key key_len ref rows filtered Extra
111 SIMPLE t1 index a a 43 NULL 5 40.00 Using where; Using index111 SIMPLE t1 index a a 43 NULL 5 40.00 Using where; Using index
12Warnings:12Warnings:
13Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like concat('abc','%'))13Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like <cache>(concat('abc','%')))
14select * from t1 where a like "abc%";14select * from t1 where a like "abc%";
15a15a
16abc16abc
1717
=== modified file 'tests/r/func_str.result'
--- tests/r/func_str.result 2009-10-31 18:12:20 +0000
+++ tests/r/func_str.result 2009-12-16 14:56:20 +0000
@@ -847,7 +847,7 @@
8471 SIMPLE t2 const PRIMARY PRIMARY 42 const 1 100.00 Using index8471 SIMPLE t2 const PRIMARY PRIMARY 42 const 1 100.00 Using index
8481 SIMPLE t1 ref code code 43 const 2 100.00 Using where; Using index8481 SIMPLE t1 ref code code 43 const 2 100.00 Using where; Using index
849Warnings:849Warnings:
850Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = 'a12') and ('a12' = 'a12') and ((length(`test`.`t1`.`code`) = 5) or ('a12' < 'a00')))850Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = 'a12') and <cache>(('a12' = 'a12')) and ((length(`test`.`t1`.`code`) = 5) or <cache>(('a12' < 'a00'))))
851DROP TABLE t1,t2;851DROP TABLE t1,t2;
852select benchmark(-1, 1);852select benchmark(-1, 1);
853benchmark(-1, 1)853benchmark(-1, 1)
854854
=== modified file 'tests/r/func_time.result'
--- tests/r/func_time.result 2009-06-16 00:53:22 +0000
+++ tests/r/func_time.result 2009-12-16 14:56:20 +0000
@@ -714,7 +714,6 @@
714f1714f1
715Warnings:715Warnings:
716Warning 1292 Incorrect datetime value: 'zzz'716Warning 1292 Incorrect datetime value: 'zzz'
717Warning 1292 Incorrect datetime value: 'zzz'
718select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);717select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
719f1718f1
7202006-01-017192006-01-01
721720
=== modified file 'tests/r/select.result'
--- tests/r/select.result 2009-11-13 00:56:59 +0000
+++ tests/r/select.result 2009-12-16 14:56:20 +0000
@@ -3661,3 +3661,46 @@
3661436614
3662536625
3663DROP TABLE t1;3663DROP TABLE t1;
3664CREATE TABLE t1 (a INT);
3665INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
3666CREATE TABLE t2 (b INT);
3667INSERT INTO t2 VALUES (2);
3668SELECT * FROM t1 WHERE a = 1 + 1;
3669a
36702
3671EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
3672id select_type table type possible_keys key key_len ref rows filtered Extra
36731 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
3674Warnings:
3675Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = <cache>((1 + 1)))
3676SELECT * FROM t1 HAVING a = 1 + 1;
3677a
36782
3679EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
3680id select_type table type possible_keys key key_len ref rows filtered Extra
36811 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
3682Warnings:
3683Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` having (`test`.`t1`.`a` = <cache>((1 + 1)))
3684SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
3685a b
36864 2
3687EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
3688id select_type table type possible_keys key key_len ref rows filtered Extra
36891 SIMPLE t2 ALL NULL NULL NULL NULL 1 100.00
36901 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer
3691Warnings:
3692Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where (`test`.`t1`.`a` = (`test`.`t2`.`b` + <cache>((1 + 1))))
3693SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
3694b a
36952 3
3696EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
3697id select_type table type possible_keys key key_len ref rows filtered Extra
36981 SIMPLE t2 ALL NULL NULL NULL NULL 1 100.00
36991 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00
3700Warnings:
3701Note 1003 select `test`.`t2`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t2` left join `test`.`t1` on((`test`.`t1`.`a` = (`test`.`t2`.`b` + 1))) where 1
3702EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');
3703id select_type table type possible_keys key key_len ref rows filtered Extra
37041 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using where
3705Warnings:
3706Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` > <cache>(unix_timestamp('2009-03-10 00:00:00')))
36643707
=== modified file 'tests/r/subselect.result'
--- tests/r/subselect.result 2009-11-19 18:26:26 +0000
+++ tests/r/subselect.result 2009-12-16 14:56:20 +0000
@@ -720,7 +720,7 @@
720Warnings:720Warnings:
721Note 1249 Select 3 was reduced during optimization721Note 1249 Select 3 was reduced during optimization
722Note 1249 Select 2 was reduced during optimization722Note 1249 Select 2 was reduced during optimization
723Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))723Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
724EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);724EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
725id select_type table type possible_keys key key_len ref rows filtered Extra725id select_type table type possible_keys key key_len ref rows filtered Extra
7261 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index7261 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
727727
=== modified file 'tests/r/subselect_no_mat.result'
--- tests/r/subselect_no_mat.result 2009-11-19 18:26:26 +0000
+++ tests/r/subselect_no_mat.result 2009-12-16 14:56:20 +0000
@@ -724,7 +724,7 @@
724Warnings:724Warnings:
725Note 1249 Select 3 was reduced during optimization725Note 1249 Select 3 was reduced during optimization
726Note 1249 Select 2 was reduced during optimization726Note 1249 Select 2 was reduced during optimization
727Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))727Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
728EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);728EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
729id select_type table type possible_keys key key_len ref rows filtered Extra729id select_type table type possible_keys key key_len ref rows filtered Extra
7301 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index7301 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
731731
=== modified file 'tests/r/subselect_no_mat_and_semi_join.result'
--- tests/r/subselect_no_mat_and_semi_join.result 2009-11-19 18:26:26 +0000
+++ tests/r/subselect_no_mat_and_semi_join.result 2009-12-16 14:56:20 +0000
@@ -724,7 +724,7 @@
724Warnings:724Warnings:
725Note 1249 Select 3 was reduced during optimization725Note 1249 Select 3 was reduced during optimization
726Note 1249 Select 2 was reduced during optimization726Note 1249 Select 2 was reduced during optimization
727Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))727Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
728EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);728EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
729id select_type table type possible_keys key key_len ref rows filtered Extra729id select_type table type possible_keys key key_len ref rows filtered Extra
7301 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index7301 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
731731
=== modified file 'tests/r/subselect_no_opts.result'
--- tests/r/subselect_no_opts.result 2009-11-19 18:26:26 +0000
+++ tests/r/subselect_no_opts.result 2009-12-16 14:56:20 +0000
@@ -724,7 +724,7 @@
724Warnings:724Warnings:
725Note 1249 Select 3 was reduced during optimization725Note 1249 Select 3 was reduced during optimization
726Note 1249 Select 2 was reduced during optimization726Note 1249 Select 2 was reduced during optimization
727Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))727Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
728EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);728EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
729id select_type table type possible_keys key key_len ref rows filtered Extra729id select_type table type possible_keys key key_len ref rows filtered Extra
7301 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index7301 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
731731
=== modified file 'tests/r/subselect_no_semijoin.result'
--- tests/r/subselect_no_semijoin.result 2009-11-19 18:26:26 +0000
+++ tests/r/subselect_no_semijoin.result 2009-12-16 14:56:20 +0000
@@ -724,7 +724,7 @@
724Warnings:724Warnings:
725Note 1249 Select 3 was reduced during optimization725Note 1249 Select 3 was reduced during optimization
726Note 1249 Select 2 was reduced during optimization726Note 1249 Select 2 was reduced during optimization
727Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))727Note 1003 select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
728EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);728EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
729id select_type table type possible_keys key key_len ref rows filtered Extra729id select_type table type possible_keys key key_len ref rows filtered Extra
7301 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index7301 PRIMARY t2 index NULL id 5 NULL 2 100.00 Using where; Using index
731731
=== modified file 'tests/t/select.test'
--- tests/t/select.test 2009-11-13 00:56:59 +0000
+++ tests/t/select.test 2009-12-16 14:56:20 +0000
@@ -3454,3 +3454,20 @@
3454SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296;3454SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296;
3455SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297;3455SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297;
3456DROP TABLE t1;3456DROP TABLE t1;
3457
3458#
3459# MySQL Bug#33546: Slowdown on re-evaluation of constant expressions.
3460#
3461CREATE TABLE t1 (a INT);
3462INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
3463CREATE TABLE t2 (b INT);
3464INSERT INTO t2 VALUES (2);
3465SELECT * FROM t1 WHERE a = 1 + 1;
3466EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1 + 1;
3467SELECT * FROM t1 HAVING a = 1 + 1;
3468EXPLAIN EXTENDED SELECT * FROM t1 HAVING a = 1 + 1;
3469SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
3470EXPLAIN EXTENDED SELECT * FROM t1, t2 WHERE a = b + (1 + 1);
3471SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
3472EXPLAIN EXTENDED SELECT * FROM t2 LEFT JOIN t1 ON a = b + 1;
3473EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > UNIX_TIMESTAMP('2009-03-10 00:00:00');
3457\ No newline at end of file3474\ No newline at end of file