In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the method of quickly deleting a large number of data by mysql, which has a certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
The method of mysql to delete a large amount of data: first, create a temporary table with the same structure as the original table; then insert the data that needs to be retained into the temporary table and drop the original table; finally, rename the temporary table to the original table name.
Mysql method to delete a large amount of data:
Option 1.
Use delete directly
Because the execution speed of delete is proportional to the number of indexes, if there are more indexes in the table, it will take hours or even days to use delete.
Option 2.
(1) create a temporary table with the same structure as the original table
(2) insert the data that needs to be retained into the temporary table
(3) original drop table
(4) rename the temporary table to the original table name
After testing, the drop table usually takes less than 3 seconds.
The main time-consuming step of this scheme is the second step. If there is not a large amount of data to be retained, this scheme is the best one.
Thank you for reading this article carefully. I hope it will be helpful for everyone to share the method and content of mysql to delete a large amount of data quickly. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.