From: Date: April 8 2008 10:02am Subject: bk commit into 5.1 tree (mattiasj:1.2576) BUG#35745 List-Archive: http://lists.mysql.com/commits/45039 X-Bug: 35745 Message-Id: <20080408080255.3FA9D412562@witty.localhost> Below is the list of changes that have just been committed into a local 5.1 repository of mattiasj. When mattiasj does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-04-08 10:02:44+02:00, mattiasj@witty. +8 -0 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. mysql-test/r/partition.result@stripped, 2008-04-08 10:02:36+02:00, mattiasj@witty. +1 -1 Updated result due to more correct number of rows mysql-test/r/partition_hash.result@stripped, 2008-04-08 10:02:36+02:00, mattiasj@witty. +6 -6 Updated result due to more correct number of rows mysql-test/r/partition_pruning.result@stripped, 2008-04-08 10:02:36+02:00, mattiasj@witty. +33 -33 Updated result due to more correct number of rows mysql-test/r/partition_range.result@stripped, 2008-04-08 10:02:36+02:00, mattiasj@witty. +6 -6 Updated result due to more correct number of rows mysql-test/suite/parts/r/partition_alter3_innodb.result@stripped, 2008-04-08 10:02:37+02:00, mattiasj@witty. +18 -18 Updated result due to more correct number of rows mysql-test/suite/parts/r/partition_alter3_myisam.result@stripped, 2008-04-08 10:02:37+02:00, mattiasj@witty. +18 -18 Updated result due to more correct number of rows sql/ha_partition.cc@stripped, 2008-04-08 10:02:38+02:00, mattiasj@witty. +28 -0 Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables. Added ha_partition::records sql/ha_partition.h@stripped, 2008-04-08 10:02:38+02:00, mattiasj@witty. +1 -0 Bug#35745: SELECT COUNT(*) is not correct for some partitioned tables. Added ha_partition::records diff -Nrup a/mysql-test/r/partition.result b/mysql-test/r/partition.result --- a/mysql-test/r/partition.result 2008-03-14 18:50:29 +01:00 +++ b/mysql-test/r/partition.result 2008-04-08 10:02:36 +02:00 @@ -929,7 +929,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 diff -Nrup a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result --- a/mysql-test/r/partition_hash.result 2007-11-20 11:20:55 +01:00 +++ b/mysql-test/r/partition_hash.result 2008-04-08 10:02:36 +02:00 @@ -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 diff -Nrup a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result --- a/mysql-test/r/partition_pruning.result 2007-09-14 12:25:39 +02:00 +++ b/mysql-test/r/partition_pruning.result 2008-04-08 10:02:36 +02:00 @@ -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) ( diff -Nrup a/mysql-test/r/partition_range.result b/mysql-test/r/partition_range.result --- a/mysql-test/r/partition_range.result 2008-02-13 11:29:48 +01:00 +++ b/mysql-test/r/partition_range.result 2008-04-08 10:02:36 +02:00 @@ -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 diff -Nrup a/mysql-test/suite/parts/r/partition_alter3_innodb.result b/mysql-test/suite/parts/r/partition_alter3_innodb.result --- a/mysql-test/suite/parts/r/partition_alter3_innodb.result 2007-11-20 16:04:04 +01:00 +++ b/mysql-test/suite/parts/r/partition_alter3_innodb.result 2008-04-08 10:02:37 +02:00 @@ -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 diff -Nrup a/mysql-test/suite/parts/r/partition_alter3_myisam.result b/mysql-test/suite/parts/r/partition_alter3_myisam.result --- a/mysql-test/suite/parts/r/partition_alter3_myisam.result 2007-11-20 16:04:04 +01:00 +++ b/mysql-test/suite/parts/r/partition_alter3_myisam.result 2008-04-08 10:02:37 +02:00 @@ -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 diff -Nrup a/sql/ha_partition.cc b/sql/ha_partition.cc --- a/sql/ha_partition.cc 2008-03-17 15:56:51 +01:00 +++ b/sql/ha_partition.cc 2008-04-08 10:02:38 +02:00 @@ -5360,6 +5360,34 @@ 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; + 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 diff -Nrup a/sql/ha_partition.h b/sql/ha_partition.h --- a/sql/ha_partition.h 2007-09-24 15:30:28 +02:00 +++ b/sql/ha_partition.h 2008-04-08 10:02:38 +02:00 @@ -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(); /* -------------------------------------------------------------------------