[MDEV-3660] LP:884631 - Table elimination works 5.3 release builds even if turned off Created: 2011-11-01  Updated: 2015-02-02  Resolved: 2012-10-04

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Sergei Petrunia Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug884631.xml    

 Description   

Table elimination works in 5.3 release builds, even if one sets @@optimizer_switch to turn it off.

create table t1 (a int);
insert into t1 values (0),(1),(2),(3);
create table t2 (a int primary key, b int)
as select a, a as b from t1 where a in (1,2);

set optimizer_switch='table_elimination=on';
explain extended select t1.a from t1 left join t2 on t2.a=t1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1

set optimizer_switch='table_elimination=off';
explain extended select t1.a from t1 left join t2 on t2.a=t1.a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1



 Comments   
Comment by Sergei Petrunia [ 2011-11-01 ]

Re: Table elimination works 5.3 release builds even if turned off
The problem is because of this code in eliminate_tables();

#ifndef DBUG_OFF
if (!optimizer_flag(thd, OPTIMIZER_SWITCH_TABLE_ELIMINATION))
DBUG_VOID_RETURN; /* purecov: inspected */
#endif

The "#ifndef DBUG_OFF" part is left since the times when table_elimination=on/off was present only in debug builds.

Comment by Sergei Petrunia [ 2011-11-01 ]

Re: Table elimination works 5.3 release builds even if turned off
The problem occurs only in 5.3 because in 5.2 table_elimination=on/off flag is only present in debug builds.

Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ]

Launchpad bug id: 884631

Generated at Thu Feb 08 06:50:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.