I Use Mysql 5.5.. + INNODB and windows server.
The case(make it simple then real case):
I have 2 tables 1GB with name new_car
and car
table 1GB.
I to replace car
table with new_car
table every 10 hours not manually(auto by code) - important to do it fast(real website data).
I read(say that drop its problem in innodb) : http://www.mysqlperformanceblog.com/2011/02/03/performance-problem-with-innodb-and-drop-table/
solution1:
DROP TABLE car;
RENAME TABLE new_car TO car;
Solution2(making drop in the end -maybe it not block the table to access that happen during drop):
RENAME TABLE car TO temp_car;
RENAME TABLE new_car TO car;
DROP TABLE temp_car;
Solution3(Truncate delete fast the table and create empty table then maybe drop action after should be very fast):
TRUNCATE TABLE car;
DROP TABLE car;
RENAME TABLE new_car TO car;
Solution4:
RENAME TABLE car TO temp_car;
RENAME TABLE new_car TO car;
TRUNCATE TABLE temp_car;
DROP TABLE temp_car;
Which solution is the best and why or please write other better solution?
Thanks
I don't understand why you would DROP the table. You always want those 2 tables and you'd (I'd assume be refilling up the New_Car table...
RENAME TABLE car TO temp_car;
RENAME TABLE new_car TO car;
TRUNCATE TABLE temp_car;
RENAME TABLE temp_car TO new_car;
RENAME TABLE car TO temp_car, new_car TO car;
TRUNCATE TABLE temp_car;
DROP TABLE temp_car;
使用替换它需要5分钟或使用负载infile批量它
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.