truncate 和 delete 的區別,truncatedelete

來源:互聯網
上載者:User

truncate 和 delete 的區別,truncatedelete

truncate table players; 等價於 delete from players;或 delete players from players;  或 delete players.*  from players;

1、truncate 速度快,如果有rollback命令,delete將被撤銷,而truncate不會。

2、truncate是ddl語句,和其他ddl一樣,它被隱式提交,不能使用rollback。

3、truncate將重設高水平線和所有的索引。

4、不能觸發任何delete 觸發器。

5、不能授予任何人清空他人表的許可權。

6、不能清空父表。

7、當表被清空後,表和表的索引重設為初始大小,而delete不能。


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.