#At file:///Users/mattiasj/clones/bzrroot/b35745-51-bugteam/
2690 Mattias Jonsson 2008-07-07
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.
modified:
mysql-test/r/partition.result
mysql-test/r/partition_hash.result
mysql-test/r/partition_pruning.result
mysql-test/r/partition_range.result
mysql-test/suite/parts/r/partition_alter3_innodb.result
mysql-test/suite/parts/r/partition_alter3_myisam.result
sql/ha_partition.cc
sql/ha_partition.h
per-file messages:
mysql-test/r/partition.result
Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
Updated since EXPLAIN PARTITIONS depend of ::records
which now instead gives the number of records in the
partitioned table
mysql-test/r/partition_hash.result
Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
Updated since EXPLAIN PARTITIONS depend of ::records
which now instead gives the number of records in the
partitioned table
mysql-test/r/partition_pruning.result
Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
Updated since EXPLAIN PARTITIONS depend of ::records
which now instead gives the number of records in the
partitioned table
mysql-test/r/partition_range.result
Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
Updated since EXPLAIN PARTITIONS depend of ::records
which now instead gives the number of records in the
partitioned table
mysql-test/suite/parts/r/partition_alter3_innodb.result
Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
Updated since EXPLAIN PARTITIONS depend of ::records
which now instead gives the number of records in the
partitioned table
mysql-test/suite/parts/r/partition_alter3_myisam.result
Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
Updated since EXPLAIN PARTITIONS depend of ::records
which now instead gives the number of records in the
partitioned table
sql/ha_partition.cc
Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
Added ha_partition::records
sql/ha_partition.h
Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables.
Added ha_partition::records
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result 2008-06-17 10:41:06 +0000
+++ b/mysql-test/r/partition.result 2008-07-07 20:14:06 +0000
@@ -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
=== modified file 'mysql-test/r/partition_hash.result'
--- a/mysql-test/r/partition_hash.result 2007-11-20 10:21:00 +0000
+++ b/mysql-test/r/partition_hash.result 2008-07-07 20:14:06 +0000
@@ -69,25 +69,25 @@ id select_type table partitions type pos
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
=== modified file 'mysql-test/r/partition_pruning.result'
--- a/mysql-test/r/partition_pruning.result 2007-09-14 10:25:45 +0000
+++ b/mysql-test/r/partition_pruning.result 2008-07-07 20:14:06 +0000
@@ -31,7 +31,7 @@ id select_type table partitions type pos
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 pos
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 pos
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 pos
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 pos
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 pos
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 pos
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 pos
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 pos
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 pos
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 pos
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) (
=== modified file 'mysql-test/r/partition_range.result'
--- a/mysql-test/r/partition_range.result 2008-02-13 10:29:50 +0000
+++ b/mysql-test/r/partition_range.result 2008-07-07 20:14:06 +0000
@@ -57,13 +57,13 @@ id select_type table partitions type pos
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
=== modified file 'mysql-test/suite/parts/r/partition_alter3_innodb.result'
--- a/mysql-test/suite/parts/r/partition_alter3_innodb.result 2007-11-20 15:04:07 +0000
+++ b/mysql-test/suite/parts/r/partition_alter3_innodb.result 2008-07-07 20:14:06 +0000
@@ -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
=== modified file 'mysql-test/suite/parts/r/partition_alter3_myisam.result'
--- a/mysql-test/suite/parts/r/partition_alter3_myisam.result 2007-11-20 15:04:07 +0000
+++ b/mysql-test/suite/parts/r/partition_alter3_myisam.result 2008-07-07 20:14:06 +0000
@@ -148,7 +148,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
@@ -175,7 +175,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
@@ -207,7 +207,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
@@ -249,7 +249,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
@@ -276,7 +276,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
@@ -301,7 +301,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
@@ -324,7 +324,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
@@ -345,7 +345,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
@@ -364,7 +364,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
@@ -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 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
@@ -518,7 +518,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
@@ -553,7 +553,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
@@ -593,7 +593,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
@@ -623,7 +623,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
@@ -651,7 +651,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 20 Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
@@ -677,7 +677,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
@@ -701,7 +701,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
@@ -723,7 +723,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
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2008-06-17 10:41:06 +0000
+++ b/sql/ha_partition.cc 2008-07-07 20:14:06 +0000
@@ -5364,6 +5364,40 @@ ha_rows ha_partition::estimate_rows_uppe
}
+/**
+ Number of rows in table. see handler.h
+
+ SYNOPSIS
+ records()
+
+ RETURN VALUE
+ Number of total rows in a partitioned table.
+*/
+
+ha_rows ha_partition::records()
+{
+ ha_rows rows, tot_rows= 0;
+ handler **file;
+ DBUG_ENTER("ha_partition::records");
+
+ file= m_file;
+ /*
+ If HA_STATS_RECORDS_IS_EXACT, use stats.records, since it can be setup
+ with the where clause
+ */
+ //if ((*file)->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT)
+ //DBUG_RETURN(stats.records);
+ do
+ {
+ rows= (*file)->records();
+ if (rows == HA_POS_ERROR)
+ DBUG_RETURN(HA_POS_ERROR);
+ tot_rows+= rows;
+ } while (*(++file));
+ DBUG_RETURN(tot_rows);
+}
+
+
/*
Is it ok to switch to a new engine for this table
=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h 2007-10-11 15:07:40 +0000
+++ b/sql/ha_partition.h 2008-07-07 20:14:06 +0000
@@ -531,6 +531,7 @@ public:
underlying handlers must have the same implementation for it to work.
*/
virtual uint8 table_cache_type();
+ virtual ha_rows records();
/*
-------------------------------------------------------------------------
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (mattiasj:2690) Bug#35745 | Mattias Jonsson | 7 Jul |