mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
42 lines
2.2 KiB
Text
42 lines
2.2 KiB
Text
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (a <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY HASH(a) PARTITIONS 2;
|
|
INSERT INTO t1 (a) VALUES (1),(2),(2),(3),(4);
|
|
ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
|
|
EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
|
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 p3 # # # # # # #
|
|
ALTER TABLE t1 COALESCE PARTITION 1;
|
|
EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 3;
|
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 p0 # # # # # # #
|
|
ALTER TABLE t1 REORGANIZE PARTITION;
|
|
EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
|
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 p0 # # # # # # #
|
|
ALTER TABLE t1 REBUILD PARTITION p0;
|
|
EXPLAIN PARTiTIONS SELECT a FROM t1;
|
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 p0 # # # # # # #
|
|
ALTER TABLE t1 REMOVE PARTITIONING;
|
|
EXPLAIN PARTiTIONS SELECT a FROM t1;
|
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 NULL # # # # # # #
|
|
ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (101,102));
|
|
ERROR HY000: Table has no partition for value 4
|
|
ALTER TABLE t1 PARTITION BY LIST(a) (PARTITION p0 VALUES IN (1,2,3,4), PARTITION p1 VALUES IN (101,102));
|
|
INSERT INTO t1 (a) VALUES (50);
|
|
ERROR HY000: Table has no partition for value 50
|
|
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (50,51));
|
|
INSERT INTO t1 (a) VALUES (50);
|
|
ALTER TABLE t1 DROP PARTITION p1;
|
|
ALTER TABLE t1 REORGANIZE PARTITION p0, p2 INTO (PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4), PARTITION p2 VALUES IN (50,51), PARTITION p3 VALUES IN (101,102));
|
|
EXPLAIN PARTiTIONS SELECT a FROM t1 WHERE a = 2;
|
|
id select_type table partitions type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 p0 # # # # # # #
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (a <INT_COLUMN>, b <INT_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS> PARTITION BY LIST(a) SUBPARTITION by HASH(b) (
|
|
PARTITION abc VALUES IN (1,2,3),
|
|
PARTITION def VALUES IN (100,101,102)
|
|
);
|
|
ALTER TABLE t1 DROP PARTITION abc;
|
|
DROP TABLE t1;
|