Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b76f3912
Commit
b76f3912
authored
Sep 13, 2010
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
daa6d1f4
a41cef53
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
465 additions
and
316 deletions
+465
-316
mysql-test/r/partition.result
mysql-test/r/partition.result
+26
-1
mysql-test/r/partition_hash.result
mysql-test/r/partition_hash.result
+6
-6
mysql-test/r/partition_innodb.result
mysql-test/r/partition_innodb.result
+9
-9
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+266
-242
mysql-test/r/partition_range.result
mysql-test/r/partition_range.result
+6
-6
mysql-test/suite/parts/r/partition_alter3_innodb.result
mysql-test/suite/parts/r/partition_alter3_innodb.result
+18
-18
mysql-test/suite/parts/r/partition_alter3_myisam.result
mysql-test/suite/parts/r/partition_alter3_myisam.result
+18
-18
mysql-test/t/partition.test
mysql-test/t/partition.test
+27
-0
mysql-test/t/partition_pruning.test
mysql-test/t/partition_pruning.test
+24
-0
sql/ha_partition.cc
sql/ha_partition.cc
+52
-15
sql/ha_partition.h
sql/ha_partition.h
+4
-0
sql/sql_select.cc
sql/sql_select.cc
+9
-1
No files found.
mysql-test/r/partition.result
View file @
b76f3912
drop table if exists t1, t2;
#
# Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
#
CREATE TABLE t1 (
`id` int NOT NULL,
`user_num` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1,8601);
INSERT INTO t1 VALUES (2,8601);
INSERT INTO t1 VALUES (3,8601);
INSERT INTO t1 VALUES (4,8601);
CREATE TABLE t2 (
`id` int(11) NOT NULL,
`user_num` int DEFAULT NULL,
`name` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM CHARSET=latin1
PARTITION BY HASH (id)
PARTITIONS 2;
INSERT INTO t2 VALUES (1,8601,'John');
INSERT INTO t2 VALUES (2,8601,'JS');
INSERT INTO t2 VALUES (3,8601,'John S');
UPDATE t1, t2 SET t2.name = 'John Smith' WHERE t1.user_num = t2.user_num;
DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b INT)
PARTITION BY LIST (a)
SUBPARTITION BY HASH (b)
...
...
@@ -1382,7 +1407,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
4
Using where
1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL
2
Using where
drop table t1;
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20))
ENGINE=MyISAM DEFAULT CHARSET=latin1
...
...
mysql-test/r/partition_hash.result
View file @
b76f3912
...
...
@@ -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
9
Using where
1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL
7
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
9
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
3
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
9
Using where
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL
5
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
9
Using where
1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL
4
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
9
Using where
1 SIMPLE t1 p1 ALL NULL NULL NULL NULL
2
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
9
Using where
1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL
4
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
...
...
mysql-test/r/partition_innodb.result
View file @
b76f3912
...
...
@@ -22,31 +22,31 @@ insert INTO t1 VALUES (110);
ERROR HY000: Table has no partition for value 110
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL
5
Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL
0
Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL
5
Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL
0
Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL
5
Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL
0
Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL
7
Using where
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL
3
Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL
7
Using where
1 SIMPLE t1 p90 ALL NULL NULL NULL NULL
3
Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL
7
Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL
0
Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL
7
Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL
0
Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL
7
Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL
0
Using where
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL
7
Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL
0
Using where
DROP TABLE t1;
#
# Bug#50104: Partitioned table with just 1 partion works with fk
...
...
mysql-test/r/partition_pruning.result
View file @
b76f3912
This diff is collapsed.
Click to expand it.
mysql-test/r/partition_range.result
View file @
b76f3912
...
...
@@ -73,13 +73,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
3
Using where
1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL
2
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
3
Using where
1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL
2
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
...
...
@@ -112,16 +112,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
6
Using where
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL
2
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
6
Using where
1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL
4
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
6
Using where
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL
2
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
6
Using where
1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL
4
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
...
...
mysql-test/suite/parts/r/partition_alter3_innodb.result
View file @
b76f3912
...
...
@@ -141,7 +141,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part1 ALL NULL NULL NULL NULL
7
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -165,7 +165,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
5
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -190,7 +190,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
3
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -226,7 +226,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p6 ALL NULL NULL NULL NULL
3
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -248,7 +248,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL
4
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -269,7 +269,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
4
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -289,7 +289,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
5
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -308,7 +308,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part1 ALL NULL NULL NULL NULL
7
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -326,7 +326,7 @@ t1.frm
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
2
0 Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
1
0 Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -452,7 +452,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
7
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -476,7 +476,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
5
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -504,7 +504,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p6 ALL NULL NULL NULL NULL
3
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -538,7 +538,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
4
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -563,7 +563,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
3
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -587,7 +587,7 @@ t1.frm
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
23
Using where
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL
10
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -610,7 +610,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
5
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -632,7 +632,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
7
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -653,7 +653,7 @@ t1.frm
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
2
0 Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
1
0 Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
mysql-test/suite/parts/r/partition_alter3_myisam.result
View file @
b76f3912
...
...
@@ -155,7 +155,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part1 ALL NULL NULL NULL NULL
7
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -187,7 +187,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
5
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -228,7 +228,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
3
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -278,7 +278,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p6 ALL NULL NULL NULL NULL
3
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -312,7 +312,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL
4
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -343,7 +343,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
4
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -371,7 +371,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
5
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -396,7 +396,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part1 ALL NULL NULL NULL NULL
7
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -418,7 +418,7 @@ t1.frm
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
2
0 Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
1
0 Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -552,7 +552,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
7
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -584,7 +584,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
5
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -628,7 +628,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p6 ALL NULL NULL NULL NULL
3
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -676,7 +676,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
4
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -713,7 +713,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
3
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -747,7 +747,7 @@ t1.frm
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
2
0 Using where
1 SIMPLE t1 p4 ALL NULL NULL NULL NULL
1
0 Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -778,7 +778,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
5
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -806,7 +806,7 @@ t1.frm
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
20
Using where
1 SIMPLE t1 part7 ALL NULL NULL NULL NULL
7
Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
@@ -831,7 +831,7 @@ t1.frm
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
2
0 Using where
1 SIMPLE t1 p0 ALL NULL NULL NULL NULL
1
0 Using where
# check read single success: 1
# check read all success: 1
# check read row by row success: 1
...
...
mysql-test/t/partition.test
View file @
b76f3912
...
...
@@ -14,6 +14,33 @@
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
echo
#
--
echo
# Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
--
echo
#
CREATE
TABLE
t1
(
`id`
int
NOT
NULL
,
`user_num`
int
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
MyISAM
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
1
,
8601
);
INSERT
INTO
t1
VALUES
(
2
,
8601
);
INSERT
INTO
t1
VALUES
(
3
,
8601
);
INSERT
INTO
t1
VALUES
(
4
,
8601
);
CREATE
TABLE
t2
(
`id`
int
(
11
)
NOT
NULL
,
`user_num`
int
DEFAULT
NULL
,
`name`
varchar
(
64
)
NOT
NULL
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
MyISAM
CHARSET
=
latin1
PARTITION
BY
HASH
(
id
)
PARTITIONS
2
;
INSERT
INTO
t2
VALUES
(
1
,
8601
,
'John'
);
INSERT
INTO
t2
VALUES
(
2
,
8601
,
'JS'
);
INSERT
INTO
t2
VALUES
(
3
,
8601
,
'John S'
);
UPDATE
t1
,
t2
SET
t2
.
name
=
'John Smith'
WHERE
t1
.
user_num
=
t2
.
user_num
;
DROP
TABLE
t1
,
t2
;
#
# Bug#48276: can't add column if subpartition exists
CREATE
TABLE
t1
(
a
INT
,
b
INT
)
...
...
mysql-test/t/partition_pruning.test
View file @
b76f3912
...
...
@@ -8,6 +8,30 @@
drop
table
if
exists
t1
,
t2
,
t3
,
t4
,
t5
,
t6
,
t7
,
t8
,
t9
;
--
enable_warnings
--
echo
#
--
echo
# Bug#53806: Wrong estimates for range query in partitioned MyISAM table
--
echo
# Bug#46754: 'rows' field doesn't reflect partition pruning
--
echo
#
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
)
PARTITION
BY
RANGE
(
a
)
(
PARTITION
p0
VALUES
LESS
THAN
(
1
),
PARTITION
p1
VALUES
LESS
THAN
(
2
),
PARTITION
p2
VALUES
LESS
THAN
(
3
),
PARTITION
p3
VALUES
LESS
THAN
(
4
),
PARTITION
p4
VALUES
LESS
THAN
(
5
),
PARTITION
p5
VALUES
LESS
THAN
(
6
),
PARTITION
max
VALUES
LESS
THAN
MAXVALUE
);
INSERT
INTO
t1
VALUES
(
-
1
),(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
);
--
replace_column
1
# 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 #
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
<=
1
;
--
replace_column
1
# 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 #
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
<
7
;
--
replace_column
1
# 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 #
EXPLAIN
PARTITIONS
SELECT
*
FROM
t1
WHERE
a
<=
1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#49742: Partition Pruning not working correctly for RANGE
--
echo
#
...
...
sql/ha_partition.cc
View file @
b76f3912
...
...
@@ -232,6 +232,8 @@ void ha_partition::init_handler_variables()
m_innodb
=
FALSE
;
m_extra_cache
=
FALSE
;
m_extra_cache_size
=
0
;
m_extra_prepare_for_update
=
FALSE
;
m_extra_cache_part_id
=
NO_CURRENT_PART_ID
;
m_handler_status
=
handler_not_initialized
;
m_low_byte_first
=
1
;
m_part_field_array
=
NULL
;
...
...
@@ -5380,9 +5382,6 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info,
when performing the sequential scan we will check this recorded value
and call extra_opt whenever we start scanning a new partition.
monty: Neads to be fixed so that it's passed to all handlers when we
move to another partition during table scan.
HA_EXTRA_NO_CACHE:
When performing a UNION SELECT HA_EXTRA_NO_CACHE is called from the
flush method in the select_union class.
...
...
@@ -5394,7 +5393,7 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info,
for. If no cache is in use they will quickly return after finding
this out. And we also ensure that all caches are disabled and no one
is left by mistake.
In the future this call will probably be deleted an we will instead call
In the future this call will probably be deleted an
d
we will instead call
::reset();
HA_EXTRA_WRITE_CACHE:
...
...
@@ -5406,8 +5405,9 @@ void ha_partition::get_dynamic_partition_info(PARTITION_INFO *stat_info,
This is called as part of a multi-table update. When the table to be
updated is also scanned then this informs MyISAM handler to drop any
caches if dynamic records are used (fixed size records do not care
about this call). We pass this along to all underlying MyISAM handlers
and ignore it for the rest.
about this call). We pass this along to the first partition to scan, and
flag that it is to be called after HA_EXTRA_CACHE when moving to the next
partition to scan.
HA_EXTRA_PREPARE_FOR_DROP:
Only used by MyISAM, called in preparation for a DROP TABLE.
...
...
@@ -5554,9 +5554,21 @@ int ha_partition::extra(enum ha_extra_function operation)
case
HA_EXTRA_PREPARE_FOR_RENAME
:
DBUG_RETURN
(
prepare_for_rename
());
break
;
case
HA_EXTRA_PREPARE_FOR_UPDATE
:
DBUG_ASSERT
(
m_extra_cache
);
/*
Needs to be run on the first partition in the range now, and
later in late_extra_cache, when switching to a new partition to scan.
*/
m_extra_prepare_for_update
=
TRUE
;
if
(
m_part_spec
.
start_part
!=
NO_CURRENT_PART_ID
)
{
DBUG_ASSERT
(
m_extra_cache_part_id
==
m_part_spec
.
start_part
);
VOID
(
m_file
[
m_part_spec
.
start_part
]
->
extra
(
HA_EXTRA_PREPARE_FOR_UPDATE
));
}
break
;
case
HA_EXTRA_NORMAL
:
case
HA_EXTRA_QUICK
:
case
HA_EXTRA_PREPARE_FOR_UPDATE
:
case
HA_EXTRA_FORCE_REOPEN
:
case
HA_EXTRA_PREPARE_FOR_DROP
:
case
HA_EXTRA_FLUSH_CACHE
:
...
...
@@ -5579,10 +5591,22 @@ int ha_partition::extra(enum ha_extra_function operation)
break
;
}
case
HA_EXTRA_NO_CACHE
:
{
int
ret
=
0
;
if
(
m_extra_cache_part_id
!=
NO_CURRENT_PART_ID
)
ret
=
m_file
[
m_extra_cache_part_id
]
->
extra
(
HA_EXTRA_NO_CACHE
);
m_extra_cache
=
FALSE
;
m_extra_cache_size
=
0
;
m_extra_prepare_for_update
=
FALSE
;
m_extra_cache_part_id
=
NO_CURRENT_PART_ID
;
DBUG_RETURN
(
ret
);
}
case
HA_EXTRA_WRITE_CACHE
:
{
m_extra_cache
=
FALSE
;
m_extra_cache_size
=
0
;
m_extra_prepare_for_update
=
FALSE
;
m_extra_cache_part_id
=
NO_CURRENT_PART_ID
;
DBUG_RETURN
(
loop_extra
(
operation
));
}
case
HA_EXTRA_IGNORE_NO_KEY
:
...
...
@@ -5710,6 +5734,7 @@ int ha_partition::extra_opt(enum ha_extra_function operation, ulong cachesize)
void
ha_partition
::
prepare_extra_cache
(
uint
cachesize
)
{
DBUG_ENTER
(
"ha_partition::prepare_extra_cache()"
);
DBUG_PRINT
(
"info"
,
(
"cachesize %u"
,
cachesize
));
m_extra_cache
=
TRUE
;
m_extra_cache_size
=
cachesize
;
...
...
@@ -5768,17 +5793,19 @@ int ha_partition::loop_extra(enum ha_extra_function operation)
{
int
result
=
0
,
tmp
;
handler
**
file
;
bool
is_select
;
DBUG_ENTER
(
"ha_partition::loop_extra()"
);
/*
TODO, 5.2: this is where you could possibly add optimisations to add the bitmap
_if_ a SELECT.
*/
is_select
=
(
thd_sql_command
(
ha_thd
())
==
SQLCOM_SELECT
);
for
(
file
=
m_file
;
*
file
;
file
++
)
{
if
(
!
is_select
||
bitmap_is_set
(
&
(
m_part_info
->
used_partitions
),
file
-
m_file
))
{
if
((
tmp
=
(
*
file
)
->
extra
(
operation
)))
result
=
tmp
;
}
}
DBUG_RETURN
(
result
);
}
...
...
@@ -5798,14 +5825,22 @@ void ha_partition::late_extra_cache(uint partition_id)
{
handler
*
file
;
DBUG_ENTER
(
"ha_partition::late_extra_cache"
);
DBUG_PRINT
(
"info"
,
(
"extra_cache %u partid %u size %u"
,
m_extra_cache
,
partition_id
,
m_extra_cache_size
));
if
(
!
m_extra_cache
)
if
(
!
m_extra_cache
&&
!
m_extra_prepare_for_update
)
DBUG_VOID_RETURN
;
file
=
m_file
[
partition_id
];
if
(
m_extra_cache_size
==
0
)
VOID
(
file
->
extra
(
HA_EXTRA_CACHE
));
else
VOID
(
file
->
extra_opt
(
HA_EXTRA_CACHE
,
m_extra_cache_size
));
if
(
m_extra_prepare_for_update
)
{
DBUG_ASSERT
(
m_extra_cache
);
VOID
(
file
->
extra
(
HA_EXTRA_PREPARE_FOR_UPDATE
));
}
m_extra_cache_part_id
=
partition_id
;
DBUG_VOID_RETURN
;
}
...
...
@@ -5826,10 +5861,12 @@ void ha_partition::late_extra_no_cache(uint partition_id)
handler
*
file
;
DBUG_ENTER
(
"ha_partition::late_extra_no_cache"
);
if
(
!
m_extra_cache
)
if
(
!
m_extra_cache
&&
!
m_extra_prepare_for_update
)
DBUG_VOID_RETURN
;
file
=
m_file
[
partition_id
];
VOID
(
file
->
extra
(
HA_EXTRA_NO_CACHE
));
DBUG_ASSERT
(
partition_id
==
m_extra_cache_part_id
);
m_extra_cache_part_id
=
NO_CURRENT_PART_ID
;
DBUG_VOID_RETURN
;
}
...
...
sql/ha_partition.h
View file @
b76f3912
...
...
@@ -154,6 +154,10 @@ private:
*/
bool
m_extra_cache
;
uint
m_extra_cache_size
;
/* The same goes for HA_EXTRA_PREPARE_FOR_UPDATE */
bool
m_extra_prepare_for_update
;
/* Which partition has active cache */
uint
m_extra_cache_part_id
;
void
init_handler_variables
();
/*
...
...
sql/sql_select.cc
View file @
b76f3912
...
...
@@ -16662,7 +16662,15 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
if
(
tab
->
select
&&
tab
->
select
->
quick
)
examined_rows
=
tab
->
select
->
quick
->
records
;
else
if
(
tab
->
type
==
JT_NEXT
||
tab
->
type
==
JT_ALL
)
examined_rows
=
tab
->
limit
?
tab
->
limit
:
tab
->
table
->
file
->
records
();
{
if
(
tab
->
limit
)
examined_rows
=
tab
->
limit
;
else
{
tab
->
table
->
file
->
info
(
HA_STATUS_VARIABLE
);
examined_rows
=
tab
->
table
->
file
->
stats
.
records
;
}
}
else
examined_rows
=
(
ha_rows
)
join
->
best_positions
[
i
].
records_read
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment