88 lines
1.4 KiB
Plaintext
88 lines
1.4 KiB
Plaintext
DROP TABLE IF EXISTS t1;
|
|
SELECT COUNT(*) FROM t1;
|
|
COUNT(*)
|
|
8192
|
|
FLUSH TABLES t1 FOR EXPORT;
|
|
UNLOCK TABLES;
|
|
DROP TABLE t1;
|
|
select count(*) from t1;
|
|
count(*)
|
|
8192
|
|
DELETE FROM t1;
|
|
select count(*) from t1;
|
|
count(*)
|
|
0
|
|
ALTER TABLE t1 DISCARD PARTITION p0,p1,p2,p3,p4,p5,p6,p7,p8 TABLESPACE;
|
|
restore: t1#P#p0 .ibd and .cfg files
|
|
restore: t1#P#p1 .ibd and .cfg files
|
|
restore: t1#P#p2 .ibd and .cfg files
|
|
restore: t1#P#p3 .ibd and .cfg files
|
|
restore: t1#P#p4 .ibd and .cfg files
|
|
restore: t1#P#p5 .ibd and .cfg files
|
|
restore: t1#P#p6 .ibd and .cfg files
|
|
restore: t1#P#p7 .ibd and .cfg files
|
|
restore: t1#P#p8 .ibd and .cfg files
|
|
ALTER TABLE t1 IMPORT PARTITION p0,p1,p2,p3,p4,p5,p6,p7,p8 TABLESPACE;
|
|
SELECT * FROM t1 PARTITION (p0,p1,p2,p3,p4,p5,p6,p7,p8) ORDER BY i;
|
|
i
|
|
0
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
SELECT * FROM t1 ORDER BY i;
|
|
i
|
|
0
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
ALTER TABLE t1 DISCARD PARTITION p9,p10 TABLESPACE;
|
|
SELECT * FROM t1 PARTITION (p0,p1,p2,p3,p4,p5,p6,p7,p8) ORDER BY i;
|
|
i
|
|
0
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
ALTER TABLE t1 DISCARD PARTITION all TABLESPACE;
|
|
Warnings:
|
|
Warning 1812 InnoDB: Tablespace is missing for table 't1'
|
|
Warning 1812 InnoDB: Tablespace is missing for table 't1'
|
|
ALTER TABLE t1 IMPORT PARTITION all TABLESPACE;
|
|
SELECT * FROM t1 PARTITION (p0,p1,p2,p3,p4,p5,p6,p7,p8) ORDER BY i;
|
|
i
|
|
0
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
SELECT COUNT(*) FROM t1 ORDER BY i;
|
|
COUNT(*)
|
|
8192
|
|
SELECT * FROM t1 WHERE i%1000 = 0 ORDER BY i;
|
|
i
|
|
0
|
|
1000
|
|
2000
|
|
3000
|
|
4000
|
|
5000
|
|
6000
|
|
7000
|
|
8000
|
|
DROP TABLE t1;
|
|
|