2010-03-04 12:29:22 +01:00
|
|
|
drop table if exists t1, t2;
|
|
|
|
#
|
2010-03-10 12:56:05 +01:00
|
|
|
# Bug#51830: Incorrect partition pruning on range partition (regression)
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (a INT NOT NULL)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
PARTITION BY RANGE(a)
|
|
|
|
(PARTITION p10 VALUES LESS THAN (10),
|
|
|
|
PARTITION p30 VALUES LESS THAN (30),
|
|
|
|
PARTITION p50 VALUES LESS THAN (50),
|
|
|
|
PARTITION p70 VALUES LESS THAN (70),
|
|
|
|
PARTITION p90 VALUES LESS THAN (90));
|
|
|
|
INSERT INTO t1 VALUES (10),(30),(50);
|
|
|
|
INSERT INTO t1 VALUES (70);
|
|
|
|
INSERT INTO t1 VALUES (80);
|
|
|
|
INSERT INTO t1 VALUES (89);
|
|
|
|
INSERT INTO t1 VALUES (90);
|
|
|
|
ERROR HY000: Table has no partition for value 90
|
|
|
|
INSERT INTO t1 VALUES (100);
|
|
|
|
ERROR HY000: Table has no partition for value 100
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
DROP TABLE t1;
|
2010-03-12 11:52:38 +01:00
|
|
|
#
|
2010-03-04 12:29:22 +01:00
|
|
|
# Bug#50104: Partitioned table with just 1 partion works with fk
|
|
|
|
#
|
|
|
|
CREATE TABLE t2 (
|
|
|
|
id INT,
|
|
|
|
PRIMARY KEY (id)
|
|
|
|
) ENGINE=InnoDB ;
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
id INT NOT NULL AUTO_INCREMENT,
|
|
|
|
parent_id INT DEFAULT NULL,
|
|
|
|
PRIMARY KEY (id),
|
|
|
|
KEY parent_id (parent_id)
|
|
|
|
) ENGINE=InnoDB;
|
|
|
|
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 1;
|
|
|
|
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
|
|
|
|
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
|
|
|
|
ALTER TABLE t1 PARTITION BY HASH (id) PARTITIONS 2;
|
|
|
|
ALTER TABLE t1 ADD CONSTRAINT test_ibfk_1 FOREIGN KEY (parent_id) REFERENCES t2 (id);
|
|
|
|
ERROR HY000: Foreign key clause is not yet supported in conjunction with partitioning
|
|
|
|
DROP TABLE t1, t2;
|
2009-09-07 10:37:54 +02:00
|
|
|
create table t1 (a int not null,
|
|
|
|
b datetime not null,
|
|
|
|
primary key (a,b))
|
|
|
|
engine=innodb
|
|
|
|
partition by range (to_days(b))
|
|
|
|
subpartition by hash (a)
|
|
|
|
subpartitions 2
|
|
|
|
( partition p0 values less than (to_days('2009-01-01')),
|
|
|
|
partition p1 values less than (to_days('2009-02-01')),
|
|
|
|
partition p2 values less than (to_days('2009-03-01')),
|
|
|
|
partition p3 values less than maxvalue);
|
|
|
|
alter table t1 reorganize partition p1,p2 into
|
|
|
|
( partition p2 values less than (to_days('2009-03-01')));
|
|
|
|
drop table t1;
|
2008-11-10 21:13:24 +01:00
|
|
|
CREATE TABLE t1 (id INT PRIMARY KEY, data INT) ENGINE = InnoDB
|
|
|
|
PARTITION BY RANGE(id) (
|
|
|
|
PARTITION p0 VALUES LESS THAN (5),
|
|
|
|
PARTITION p1 VALUES LESS THAN (10),
|
|
|
|
PARTITION p2 VALUES LESS THAN MAXVALUE
|
|
|
|
);
|
|
|
|
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8),
|
|
|
|
(9,9), (10,10), (11,11);
|
|
|
|
SET @old_tx_isolation := @@session.tx_isolation;
|
|
|
|
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
|
|
|
SET autocommit = 0;
|
|
|
|
UPDATE t1 SET DATA = data*2 WHERE id = 3;
|
|
|
|
SHOW ENGINE InnoDB STATUS;
|
|
|
|
Type Name Status
|
|
|
|
InnoDB 2 lock struct(s) 1 row lock(s)
|
|
|
|
UPDATE t1 SET data = data*2 WHERE data = 2;
|
|
|
|
SHOW ENGINE InnoDB STATUS;
|
|
|
|
Type Name Status
|
|
|
|
InnoDB 6 lock struct(s) 2 row lock(s)
|
|
|
|
SET @@session.tx_isolation = @old_tx_isolation;
|
|
|
|
DROP TABLE t1;
|
2008-10-10 12:01:01 +02:00
|
|
|
# Bug#37721, test of ORDER BY on PK and WHERE on INDEX
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
a INT,
|
|
|
|
b INT,
|
|
|
|
PRIMARY KEY (a),
|
|
|
|
INDEX (b))
|
|
|
|
ENGINE InnoDB
|
|
|
|
PARTITION BY HASH(a)
|
|
|
|
PARTITIONS 3;
|
|
|
|
INSERT INTO t1 VALUES (0,0),(4,0),(2,0);
|
|
|
|
SELECT a FROM t1 WHERE b = 0 ORDER BY a ASC;
|
|
|
|
a
|
|
|
|
0
|
|
|
|
2
|
|
|
|
4
|
|
|
|
SELECT a FROM t1 WHERE b = 0 ORDER BY a DESC;
|
|
|
|
a
|
|
|
|
4
|
|
|
|
2
|
|
|
|
0
|
|
|
|
ALTER TABLE t1 DROP INDEX b;
|
|
|
|
SELECT a FROM t1 WHERE b = 0 ORDER BY a ASC;
|
|
|
|
a
|
|
|
|
0
|
|
|
|
2
|
|
|
|
4
|
|
|
|
SELECT a FROM t1 WHERE b = 0 ORDER BY a DESC;
|
|
|
|
a
|
|
|
|
4
|
|
|
|
2
|
|
|
|
0
|
|
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
a VARCHAR(600),
|
|
|
|
b VARCHAR(600),
|
|
|
|
PRIMARY KEY (a),
|
|
|
|
INDEX (b))
|
|
|
|
ENGINE InnoDB
|
|
|
|
PARTITION BY KEY(a)
|
|
|
|
PARTITIONS 3;
|
|
|
|
INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'1'),repeat('0',257));
|
|
|
|
INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'3'),repeat('0',257));
|
|
|
|
INSERT INTO t1 VALUES (concat(repeat('MySQL',100),'2'),repeat('0',257));
|
|
|
|
SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a ASC;
|
|
|
|
right(a,1)
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a DESC;
|
|
|
|
right(a,1)
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
ALTER TABLE t1 DROP INDEX b;
|
|
|
|
SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a ASC;
|
|
|
|
right(a,1)
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
SELECT right(a,1) FROM t1 WHERE b = repeat('0',257) ORDER BY a DESC;
|
|
|
|
right(a,1)
|
|
|
|
3
|
|
|
|
2
|
|
|
|
1
|
|
|
|
DROP TABLE t1;
|
2007-12-06 14:43:06 +01:00
|
|
|
# Bug#32948
|
|
|
|
CREATE TABLE t1 (c1 INT, PRIMARY KEY (c1)) ENGINE=INNODB;
|
|
|
|
CREATE TABLE t2 (c1 INT, PRIMARY KEY (c1),
|
|
|
|
FOREIGN KEY (c1) REFERENCES t1 (c1)
|
|
|
|
ON DELETE CASCADE)
|
|
|
|
ENGINE=INNODB;
|
|
|
|
ALTER TABLE t1 PARTITION BY HASH(c1) PARTITIONS 5;
|
|
|
|
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
|
|
|
|
ALTER TABLE t1 ENGINE=MyISAM;
|
|
|
|
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
|
|
|
|
DROP TABLE t2;
|
|
|
|
DROP TABLE t1;
|
2006-05-18 19:16:51 +02:00
|
|
|
create table t1 (a int) engine=innodb partition by hash(a) ;
|
|
|
|
show table status like 't1';
|
|
|
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
2008-01-15 06:55:50 +01:00
|
|
|
t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
2006-05-18 19:16:51 +02:00
|
|
|
drop table t1;
|
2006-09-08 09:18:05 +02:00
|
|
|
create table t1 (a int)
|
|
|
|
engine = innodb
|
|
|
|
partition by key (a);
|
|
|
|
show table status;
|
|
|
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
2008-01-15 06:55:50 +01:00
|
|
|
t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
2006-09-08 09:18:05 +02:00
|
|
|
insert into t1 values (0), (1), (2), (3);
|
|
|
|
show table status;
|
|
|
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
2008-01-15 06:55:50 +01:00
|
|
|
t1 InnoDB 10 Compact 4 4096 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
|
2006-09-08 09:18:05 +02:00
|
|
|
drop table t1;
|
|
|
|
create table t1 (a int auto_increment primary key)
|
|
|
|
engine = innodb
|
|
|
|
partition by key (a);
|
|
|
|
show table status;
|
|
|
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
2008-01-15 06:55:50 +01:00
|
|
|
t1 InnoDB 10 Compact 2 8192 16384 0 0 # 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
2006-09-08 09:18:05 +02:00
|
|
|
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
|
|
|
show table status;
|
|
|
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
2008-01-15 06:55:50 +01:00
|
|
|
t1 InnoDB 10 Compact 4 4096 16384 0 0 # 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
2006-09-08 09:18:05 +02:00
|
|
|
insert into t1 values (NULL), (NULL), (NULL), (NULL);
|
|
|
|
show table status;
|
|
|
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
2008-01-15 06:55:50 +01:00
|
|
|
t1 InnoDB 10 Compact 8 2048 16384 0 0 # 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
|
2006-09-08 09:18:05 +02:00
|
|
|
drop table t1;
|
|
|
|
create table t1 (a int)
|
|
|
|
partition by key (a)
|
|
|
|
(partition p1 engine = innodb);
|
|
|
|
alter table t1 rebuild partition p1;
|
|
|
|
alter table t1 rebuild partition p1;
|
|
|
|
alter table t1 rebuild partition p1;
|
|
|
|
alter table t1 rebuild partition p1;
|
|
|
|
alter table t1 rebuild partition p1;
|
|
|
|
alter table t1 rebuild partition p1;
|
|
|
|
alter table t1 rebuild partition p1;
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (a date)
|
|
|
|
engine = innodb
|
|
|
|
partition by range (year(a))
|
|
|
|
(partition p0 values less than (2006),
|
|
|
|
partition p1 values less than (2007));
|
|
|
|
explain partitions select * from t1
|
|
|
|
where a between '2006-01-01' and '2007-06-01';
|
|
|
|
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
|
|
|
|
drop table t1;
|
|
|
|
create table t1 (a int)
|
|
|
|
engine = x
|
|
|
|
partition by key (a);
|
|
|
|
Warnings:
|
Bug#24392 (SHOW ENGINE MUTEX STATUS is a synonym for SHOW INNODB STATUS)
Before this fix, the command SHOW ENGINE <name> STATUS would:
- print a warning if the engine name is unknown,
- proceed and implement the same behavior as SHOW ENGINE ALL STATUS,
and list the status of all the storage engines registered.
In particular, this behavior caused confusion about the command :
SHOW ENGINE MUTEX STATUS, which as a side effect would print the status
of the innodb engine when that engine is registered.
Also, before this fix, every time an unknown engine name was substituted by
the default engine (which happen unless SQL_MODE NO_ENGINE_SUBSTITUTION is
set), a malformed warning was raised.
For example, the command ALTER TABLE T1 ENGINE = X would print :
Warnings:
Error 1286 Unknown table engine 'X'
With this fix:
SHOW ENGINE <name> STATUS|LOGS|MUTEX
always fails with an error when the engine <name> is unknown.
For other commands, warnings about unknown engines are raised as:
Warnings:
Warning 1286 Unknown table engine 'X'
In other words, engine substitution never affect the SHOW ENGINE command,
since this would lead to very confusing results.
mysql-test/r/ndb_dd_basic.result:
Warnings for unknown engines.
mysql-test/r/partition_innodb.result:
Warnings for unknown engines.
mysql-test/r/ps_1general.result:
Fixed SHOW ENGINE <name> STATUS|LOGS|MUTEX
mysql-test/r/show_check.result:
Fixed SHOW ENGINE <name> STATUS|LOGS|MUTEX
mysql-test/t/ps_1general.test:
Fixed SHOW ENGINE <name> STATUS|LOGS|MUTEX
mysql-test/t/show_check.test:
Fixed SHOW ENGINE <name> STATUS|LOGS|MUTEX
sql/sql_yacc.yy:
Fixed SHOW ENGINE <name> STATUS|LOGS|MUTEX
2007-01-23 23:14:08 +01:00
|
|
|
Warning 1286 Unknown table engine 'x'
|
2007-04-16 18:16:17 +02:00
|
|
|
Warning 1266 Using storage engine MyISAM for table 't1'
|
2006-09-08 09:18:05 +02:00
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`a` int(11) DEFAULT NULL
|
2008-11-04 08:43:21 +01:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
|
|
/*!50100 PARTITION BY KEY (a) */
|
2006-09-08 09:18:05 +02:00
|
|
|
drop table t1;
|
|
|
|
create table t1 (a int)
|
|
|
|
engine = innodb
|
|
|
|
partition by list (a)
|
|
|
|
(partition p0 values in (0));
|
|
|
|
alter table t1 engine = x;
|
2008-01-09 13:15:50 +01:00
|
|
|
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
|
2006-09-08 09:18:05 +02:00
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`a` int(11) DEFAULT NULL
|
2008-11-04 08:43:21 +01:00
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
|
|
/*!50100 PARTITION BY LIST (a)
|
|
|
|
(PARTITION p0 VALUES IN (0) ENGINE = InnoDB) */
|
2006-09-08 09:18:05 +02:00
|
|
|
drop table t1;
|
2007-02-27 20:01:03 +01:00
|
|
|
create table t1
|
|
|
|
(
|
|
|
|
id int unsigned auto_increment,
|
|
|
|
time datetime not null,
|
|
|
|
first_name varchar(40),
|
|
|
|
last_name varchar(50),
|
|
|
|
primary key (id, time),
|
|
|
|
index first_index (first_name),
|
|
|
|
index last_index (last_name)
|
|
|
|
) engine=Innodb partition by range (to_days(time)) (
|
|
|
|
partition p1 values less than (to_days('2007-02-07')),
|
|
|
|
partition p2 values less than (to_days('2007-02-08')),
|
|
|
|
partition p3 values less than MAXVALUE
|
|
|
|
);
|
|
|
|
insert into t1 (time, first_name, last_name) values ('2007-02-07', 'Q', 'Robert'),
|
|
|
|
('2007-02-07', 'Mark', 'Nate'), ('2007-02-07', 'Nate', 'Oscar'),
|
|
|
|
('2007-02-07', 'Zack', 'Alice'), ('2007-02-07', 'Jack', 'Kathy'),
|
|
|
|
('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Brian', 'Charles'),
|
|
|
|
('2007-02-06', 'Charles', 'David'), ('2007-02-06', 'David', 'Eric'),
|
|
|
|
('2007-02-07', 'Hector', 'Isaac'), ('2007-02-07', 'Oscar', 'Patricia'),
|
|
|
|
('2007-02-07', 'Patricia', 'Q'), ('2007-02-07', 'X', 'Yuri'),
|
|
|
|
('2007-02-07', 'Robert', 'Shawn'), ('2007-02-07', 'Kathy', 'Lois'),
|
|
|
|
('2007-02-07', 'Eric', 'Francis'), ('2007-02-06', 'Shawn', 'Theron'),
|
|
|
|
('2007-02-06', 'U', 'Vincent'), ('2007-02-06', 'Francis', 'George'),
|
|
|
|
('2007-02-06', 'George', 'Hector'), ('2007-02-06', 'Vincent', 'Walter'),
|
|
|
|
('2007-02-06', 'Walter', 'X'), ('2007-02-07', 'Lois', 'Mark'),
|
|
|
|
('2007-02-07', 'Yuri', 'Zack'), ('2007-02-07', 'Isaac', 'Jack'),
|
|
|
|
('2007-02-07', 'Sharon', 'Mark'), ('2007-02-07', 'Michael', 'Michelle'),
|
|
|
|
('2007-02-07', 'Derick', 'Nathan'), ('2007-02-07', 'Peter', 'Xavier'),
|
|
|
|
('2007-02-07', 'Fred', 'Harold'), ('2007-02-07', 'Katherine', 'Lisa'),
|
|
|
|
('2007-02-07', 'Tom', 'Rina'), ('2007-02-07', 'Jerry', 'Victor'),
|
|
|
|
('2007-02-07', 'Alexander', 'Terry'), ('2007-02-07', 'Justin', 'John'),
|
|
|
|
('2007-02-07', 'Greg', 'Ernest'), ('2007-02-07', 'Robert', 'Q'),
|
|
|
|
('2007-02-07', 'Nate', 'Mark'), ('2007-02-07', 'Oscar', 'Nate'),
|
|
|
|
('2007-02-07', 'Alice', 'Zack'), ('2007-02-07', 'Kathy', 'Jack'),
|
|
|
|
('2007-02-06', 'Alice', 'Alice'), ('2007-02-06', 'Charles', 'Brian'),
|
|
|
|
('2007-02-06', 'David', 'Charles'), ('2007-02-06', 'Eric', 'David'),
|
|
|
|
('2007-02-07', 'Isaac', 'Hector'), ('2007-02-07', 'Patricia', 'Oscar'),
|
|
|
|
('2007-02-07', 'Q', 'Patricia'), ('2007-02-07', 'Yuri', 'X'),
|
|
|
|
('2007-02-07', 'Shawn', 'Robert'), ('2007-02-07', 'Lois', 'Kathy'),
|
|
|
|
('2007-02-07', 'Francis', 'Eric'), ('2007-02-06', 'Theron', 'Shawn'),
|
|
|
|
('2007-02-06', 'Vincent', 'U'), ('2007-02-06', 'George', 'Francis'),
|
|
|
|
('2007-02-06', 'Hector', 'George'), ('2007-02-06', 'Walter', 'Vincent'),
|
|
|
|
('2007-02-06', 'X', 'Walter'), ('2007-02-07', 'Mark', 'Lois'),
|
|
|
|
('2007-02-07', 'Zack', 'Yuri'), ('2007-02-07', 'Jack', 'Isaac'),
|
|
|
|
('2007-02-07', 'Mark', 'Sharon'), ('2007-02-07', 'Michelle', 'Michael'),
|
|
|
|
('2007-02-07', 'Nathan', 'Derick'), ('2007-02-07', 'Xavier', 'Peter'),
|
|
|
|
('2007-02-07', 'Harold', 'Fred'), ('2007-02-07', 'Lisa', 'Katherine'),
|
|
|
|
('2007-02-07', 'Rina', 'Tom'), ('2007-02-07', 'Victor', 'Jerry'),
|
|
|
|
('2007-02-07', 'Terry', 'Alexander'), ('2007-02-07', 'John', 'Justin'),
|
|
|
|
('2007-02-07', 'Ernest', 'Greg');
|
|
|
|
SELECT * FROM t1 WHERE first_name='Andy' OR last_name='Jake';
|
|
|
|
id time first_name last_name
|
|
|
|
drop table t1;
|
2007-09-13 15:33:40 +02:00
|
|
|
CREATE TABLE t1 (a DOUBLE NOT NULL, KEY(a)) ENGINE=InnoDB
|
|
|
|
PARTITION BY KEY(a) PARTITIONS 10;
|
|
|
|
INSERT INTO t1 VALUES(1),(2);
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
COUNT(*)
|
|
|
|
2
|
|
|
|
DROP TABLE t1;
|
2007-11-12 11:26:09 +01:00
|
|
|
create table t1 (int_column int, char_column char(5))
|
2007-11-13 06:41:59 +01:00
|
|
|
PARTITION BY RANGE (int_column) subpartition by key (char_column) subpartitions 2
|
2007-11-12 11:26:09 +01:00
|
|
|
(PARTITION p1 VALUES LESS THAN (5) ENGINE = InnoDB);
|
2008-01-09 13:15:50 +01:00
|
|
|
alter table t1
|
|
|
|
ENGINE = MyISAM
|
|
|
|
PARTITION BY RANGE (int_column)
|
2007-11-13 06:41:59 +01:00
|
|
|
subpartition by key (char_column) subpartitions 2
|
2008-01-09 13:15:50 +01:00
|
|
|
(PARTITION p1 VALUES LESS THAN (5));
|
2007-11-12 11:26:09 +01:00
|
|
|
show create table t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`int_column` int(11) DEFAULT NULL,
|
|
|
|
`char_column` char(5) DEFAULT NULL
|
2008-11-04 08:43:21 +01:00
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
|
|
/*!50100 PARTITION BY RANGE (int_column)
|
|
|
|
SUBPARTITION BY KEY (char_column)
|
|
|
|
SUBPARTITIONS 2
|
|
|
|
(PARTITION p1 VALUES LESS THAN (5) ENGINE = MyISAM) */
|
2007-11-12 11:26:09 +01:00
|
|
|
drop table t1;
|
2009-09-02 13:19:28 +02:00
|
|
|
CREATE TABLE t1 (a INT) ENGINE=InnoDB
|
|
|
|
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
|
|
|
|
CREATE INDEX i1 ON t1 (a);
|
|
|
|
DROP TABLE t1;
|
2010-01-18 17:49:18 +01:00
|
|
|
#
|
|
|
|
# Bug#47343: InnoDB fails to clean-up after lock wait timeout on
|
|
|
|
# REORGANIZE PARTITION
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (
|
|
|
|
a INT,
|
|
|
|
b DATE NOT NULL,
|
|
|
|
PRIMARY KEY (a, b)
|
|
|
|
) ENGINE=InnoDB
|
|
|
|
PARTITION BY RANGE (a) (
|
|
|
|
PARTITION pMAX VALUES LESS THAN MAXVALUE
|
|
|
|
) ;
|
|
|
|
INSERT INTO t1 VALUES (1, '2001-01-01'), (2, '2002-02-02'), (3, '2003-03-03');
|
|
|
|
START TRANSACTION;
|
|
|
|
SELECT * FROM t1 FOR UPDATE;
|
|
|
|
a b
|
|
|
|
1 2001-01-01
|
|
|
|
2 2002-02-02
|
|
|
|
3 2003-03-03
|
|
|
|
# Connection con1
|
|
|
|
ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
|
|
|
|
(PARTITION p3 VALUES LESS THAN (3),
|
|
|
|
PARTITION pMAX VALUES LESS THAN MAXVALUE);
|
|
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
|
|
SHOW WARNINGS;
|
|
|
|
Level Code Message
|
|
|
|
Error 1205 Lock wait timeout exceeded; try restarting transaction
|
|
|
|
ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
|
|
|
|
(PARTITION p3 VALUES LESS THAN (3),
|
|
|
|
PARTITION pMAX VALUES LESS THAN MAXVALUE);
|
|
|
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
|
|
|
SHOW WARNINGS;
|
|
|
|
Level Code Message
|
|
|
|
Error 1205 Lock wait timeout exceeded; try restarting transaction
|
|
|
|
t1.frm
|
|
|
|
t1.par
|
|
|
|
# Connection default
|
|
|
|
SELECT * FROM t1;
|
|
|
|
a b
|
|
|
|
1 2001-01-01
|
|
|
|
2 2002-02-02
|
|
|
|
3 2003-03-03
|
|
|
|
COMMIT;
|
|
|
|
DROP TABLE t1;
|