I deleted part of the data:
mysql> Delete from pending_22 limit 1000;
Query OK, 1000 rows Affected (2.99 sec)
But delete does not automatically free space, the table table space size is still before size: 30408704
To release the next space by optimize table:
mysql> optimize table pending_22; +------------------+----------+----------+-------------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+------------------+----------+----------+-------------------------------------------------------------------+
| np002.pending_22 | Optimize | Note | Table does not support optimize, doing recreate + analyze instead |
| np002.pending_22 | Optimize | Status | OK |
+------------------+----------+----------+-------------------------------------------------------------------+
2 rows in Set (7.49 sec)
The table is a InnoDB type.
Solution:
mysql> ALTER TABLE pending_22 ENGINE=INNODB;
Query OK, 8299 rows Affected (6.63 sec)
records:8299 duplicates:0 warnings:0
Again, the size of the table space becomes 27262976.
Note: The prerequisite for optimization is a standalone tablespace pattern (parameter innodb_file_per_table on), otherwise there is no effect.
For shared table space mode, to free up disk space, refer to: http://blog.csdn.net/yabingshi_tech/article/details/52274990