[MDEV-15321] different results when using value of optimizer_use_condition_selectivity=4 and =1 Created: 2018-02-15  Updated: 2018-07-10  Resolved: 2018-03-16

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.1, 10.2
Fix Version/s: 10.1.32

Type: Bug Priority: Minor
Reporter: Alice Sherepa Assignee: Varun Gupta (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-11062 Different result for time type with o... Closed
Relates
relates to MDEV-15253 Default optimizer setting changes for... Closed
Sprint: 10.1.32

 Description   

from t/type_time.test

SET @@old_mode=zero_date_time_cast;
CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES ('0000-00-00 10:20:30'),('0000-00-00 10:20:31');
INSERT INTO t1 VALUES ('0000-00-01 10:20:30'),('0000-00-01 10:20:31');
INSERT INTO t1 VALUES ('31 10:20:30'),('32 10:20:30'),('33 10:20:30'),('34 10:20:30');
 
SET @@optimizer_use_condition_selectivity=1;
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
 
SET @@optimizer_use_condition_selectivity=4;
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' AND LENGTH(a)=8;

MariaDB [test]> SET @@optimizer_use_condition_selectivity=1;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> SELECT * FROM t1 WHERE a='0000-00-01 10:20:30' ;
+----------+
| a        |
+----------+
| 34:20:30 |
+----------+
1 row in set (0.00 sec)
 
MariaDB [test]> SET @@optimizer_use_condition_selectivity=4;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]> SELECT * FROM t1 WHERE a='0000-00-01 10:20:30';
Empty set (0.00 sec)


Generated at Thu Feb 08 08:20:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.