1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
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 test/t1#p#p9.
Warning 1812 InnoDB: Tablespace is missing for table test/t1#p#p10.
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;
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing");
call mtr.add_suppression("InnoDB: Cannot delete tablespace .* in DISCARD TABLESPACE. Tablespace not found");
call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache.");
call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file");
call mtr.add_suppression("InnoDB: Operating system error number 2 in a file operation.");
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified.");
|