Commit c499df92 authored by Mattias Jonsson's avatar Mattias Jonsson
Browse files

Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.

problem was that ha_partition::records was not implemented, thus
using the default handler::records, which is not correct if the engine
does not support HA_STATS_RECORDS_IS_EXACT.
Solution was to implement ha_partition::records as a wrapper around
the underlying partitions records.

The rows column in explain partitions will now include the total
number of records in the partitioned table.

(recommit after removing out-commented code)
parent 0a638f6b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1131,7 +1131,7 @@ NULL
2
explain partitions select * from t1 where a is null or a < 0 or a > 1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	pn,p2	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	pn,p2	ALL	NULL	NULL	NULL	NULL	4	Using where
drop table t1;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20)) 
ENGINE=MyISAM DEFAULT CHARSET=latin1
+6 −6
Original line number Diff line number Diff line
@@ -69,25 +69,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t1	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0,p2,p3	ALL	NULL	NULL	NULL	NULL	7	Using where
1	SIMPLE	t1	p0,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
explain partitions select * from t1 where a is null;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	9	Using where
explain partitions select * from t1 where a is not null;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
explain partitions select * from t1 where a >= 1 and a < 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	5	Using where
1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	9	Using where
explain partitions select * from t1 where a >= 3 and a <= 5;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	9	Using where
explain partitions select * from t1 where a > 2 and a < 4;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p1	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p1	ALL	NULL	NULL	NULL	NULL	9	Using where
explain partitions select * from t1 where a > 3 and a <= 6;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
explain partitions select * from t1 where a > 5;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
+33 −33
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t2	p0,p1	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t2 where a=1 and b=1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	3	Using where
create table t3 (
a int
)
@@ -89,25 +89,25 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain partitions select * from t5
where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t5	p0_p0sp0,p0_p0sp1	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t5	p0_p0sp0,p0_p0sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3)
or (a=10 and b = 4);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t5 where (c=1 and d=1);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t5	p0_p0sp0,p1_p1sp0	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t5	p0_p0sp0,p1_p1sp0	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t5 where (c=2 and d=1);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t5	p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t5	p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or 
(c=2 and d=1);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or 
(b=2 and c=2 and d=1);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
create table t6 (a int not null) partition by LIST(a) (
partition p1 values in (1),
partition p3 values in (3),
@@ -145,7 +145,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t6	p5,p7,p9	system	NULL	NULL	NULL	NULL	1	
explain partitions select * from t6 where a >= 3 and a <= 8;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t6 where a > 3 and a < 5;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
@@ -187,7 +187,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t6	p5,p7,p9	system	NULL	NULL	NULL	NULL	1	
explain partitions select * from t6 where a >= 3 and a <= 8;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t6 where a > 3 and a < 5;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
@@ -342,7 +342,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain partitions
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	X	p1,p2	ALL	a	NULL	NULL	NULL	2	Using where
1	SIMPLE	X	p1,p2	ALL	a	NULL	NULL	NULL	4	Using where
1	SIMPLE	Y	p1,p2	ref	a	a	4	test.X.a	2	
drop table t1;
create table t1 (a int) partition by hash(a) partitions 20;
@@ -355,7 +355,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	2	Using where
explain partitions select * from t1 where a >  1 and a <= 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t1 where a >= 1 and a <= 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p1,p2,p3	ALL	NULL	NULL	NULL	NULL	3	Using where
@@ -445,22 +445,22 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t2	p0,p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	1010	
explain partitions select * from t2 where a < 801 and a > 200;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	800	Using where
1	SIMPLE	t2	p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
explain partitions select * from t2 where a < 801 and a > 800;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p4	ALL	NULL	NULL	NULL	NULL	200	Using where
1	SIMPLE	t2	p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
explain partitions select * from t2 where a > 600;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	400	Using where
1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
explain partitions select * from t2 where a > 600 and b = 1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	400	Using where
1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
explain partitions select * from t2 where a > 600 and b = 4;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	400	Using where
1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
explain partitions select * from t2 where a > 600 and b = 5;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	400	Using where
1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
explain partitions select * from t2 where b = 5;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0,p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
@@ -515,19 +515,19 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t2	p0,p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	910	
explain partitions select * from t2 where a = 101;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	110	Using where
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	910	Using where
explain partitions select * from t2 where a = 550;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	200	Using where
1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	910	Using where
explain partitions select * from t2 where a = 833;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p4	ALL	NULL	NULL	NULL	NULL	200	Using where
1	SIMPLE	t2	p4	ALL	NULL	NULL	NULL	NULL	910	Using where
explain partitions select * from t2 where (a = 100 OR a = 900);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0,p4	ALL	NULL	NULL	NULL	NULL	310	Using where
1	SIMPLE	t2	p0,p4	ALL	NULL	NULL	NULL	NULL	910	Using where
explain partitions select * from t2 where (a > 100 AND a < 600);
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	710	Using where
1	SIMPLE	t2	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	910	Using where
explain partitions select * from t2 where b = 4;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0,p1,p2,p3,p4	ref	b	b	5	const	76	Using where
@@ -813,17 +813,17 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
explain partitions select * from t1 
where a >= 18446744073709551000-1 and a <= 18446744073709551000+1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p3,p4	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t1	p3,p4	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t1 
where a between 18446744073709551001 and 18446744073709551002;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t1 where a = 18446744073709551000;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t1 where a = 18446744073709551613;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t1 where a = 18446744073709551614;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
@@ -850,10 +850,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
explain partitions select * from t1 where a=0xFE;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t2 where a=0xFE;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t1 where a > 0xFE AND a <= 0xFF;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
@@ -862,22 +862,22 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t1 where a < 64 AND a >= 63;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t2 where a < 64 AND a >= 63;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	4	Using where
explain partitions select * from t1 where a <= 64 AND a >= 63;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	6	Using where
explain partitions select * from t2 where a <= 64 AND a >= 63;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t2	p0,p1	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t2	p0,p1	ALL	NULL	NULL	NULL	NULL	6	Using where
drop table t1;
drop table t2;
create table t1(a bigint unsigned not null) partition by range(a+0) (
+6 −6
Original line number Diff line number Diff line
@@ -57,13 +57,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra
1	SIMPLE	t1	pnull	system	NULL	NULL	NULL	NULL	1	
explain partitions select * from t1 where a >= 0;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t1 where a < 0;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
explain partitions select * from t1 where a <= 0;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	pnull,p0	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	pnull,p0	ALL	NULL	NULL	NULL	NULL	3	Using where
explain partitions select * from t1 where a > 1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
@@ -96,16 +96,16 @@ select * from t1 where a > 1;
a	b
explain partitions select * from t1 where a is null;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1	ALL	NULL	NULL	NULL	NULL	6	Using where
explain partitions select * from t1 where a >= 0;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t1	p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	6	Using where
explain partitions select * from t1 where a < 0;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1	ALL	NULL	NULL	NULL	NULL	2	Using where
1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1	ALL	NULL	NULL	NULL	NULL	6	Using where
explain partitions select * from t1 where a <= 0;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1	ALL	NULL	NULL	NULL	NULL	6	Using where
explain partitions select * from t1 where a > 1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+18 −18
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	part1	ALL	NULL	NULL	NULL	NULL	7	Using where
1	SIMPLE	t1	part1	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -153,7 +153,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	5	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -169,7 +169,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -197,7 +197,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p6	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t1	p6	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -212,7 +212,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -227,7 +227,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -242,7 +242,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	5	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -257,7 +257,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	part1	ALL	NULL	NULL	NULL	NULL	7	Using where
1	SIMPLE	t1	part1	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -272,7 +272,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10';
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	10	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -391,7 +391,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	7	Using where
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -410,7 +410,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	5	Using where
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -429,7 +429,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p6	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t1	p6	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -455,7 +455,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	4	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -473,7 +473,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	3	Using where
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -491,7 +491,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	10	Using where
1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	23	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -509,7 +509,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	5	Using where
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -527,7 +527,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	7	Using where
1	SIMPLE	t1	part7	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -545,7 +545,7 @@ MYSQLTEST_VARDIR/master-data/test/t1.frm
MYSQLTEST_VARDIR/master-data/test/t1.par
EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	10	Using where
1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	20	Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
Loading