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.");