看到这儿的话,最后看下这篇文章,对于操作海量数据的sql深入分析
cnblogs - 深度分析DROP,TRUNCATE与DELETE的区别【我的数据库之路系列】
dzh项目海量数据删除实战,看了上面文章,考虑truncate只能删除数据,表没有删掉,我就用了drop
需求,除了dzh_weibo_cache表其余的都要删除
dzh_weibo_cache --2000w
dzh_weibo_cache111 --1500w
dzh_weibo_cache2 --400w
dzh_weibo_cache3 --700w
下面数操作后的结果,drop对于删除海量数据表方便又快
mysql> show tables;
+---------------------------+
| Tables_in_dzh_crawl_weibo |
+---------------------------+
| dzh_weibo_cache |
| dzh_weibo_cache111 |
| dzh_weibo_cache2 |
| dzh_weibo_cache3 |
+---------------------------+
4 rows in set (0.00 sec)
mysql> DROP TABLE dzh_weibo_cache2;
Query OK, 0 rows affected (8.50 sec)
mysql> show tables;
+---------------------------+
| Tables_in_dzh_crawl_weibo |
+---------------------------+
| dzh_weibo_cache |
| dzh_weibo_cache111 |
| dzh_weibo_cache3 |
+---------------------------+
3 rows in set (0.00 sec)
mysql> DROP TABLE dzh_weibo_cache3;
Query OK, 0 rows affected (10.85 sec)
mysql> show tables;
+---------------------------+
| Tables_in_dzh_crawl_weibo |
+---------------------------+
| dzh_weibo_cache |
| dzh_weibo_cache111 |
+---------------------------+
2 rows in set (0.00 sec)
mysql> DROP TABLE dzh_weibo_cache111;
Query OK, 0 rows affected (18.84 sec)