drop會刪除整個表里的數(shù)據(jù)表結(jié)構(gòu)。事務(wù)不可回滾。
? 1 drop table test;truncate會刪除表里的所有數(shù)據(jù),不會逐行操作。且事務(wù)無法回滾。
? 1 truncate table test;delete針對的是每行數(shù)據(jù)。事務(wù)可回滾。
? 1 delete from test where id=1;truncate針對的是全表數(shù)據(jù),不會做逐行操作,而delete針對的是每行數(shù)據(jù)。所以truncate的性能高于delete。
新聞熱點
疑難解答
圖片精選