ITPub博客

首页 > Linux操作系统 > Linux操作系统 > SET XXXXX=1 能加上原来的约束吗?

SET XXXXX=1 能加上原来的约束吗?

原创 Linux操作系统 作者:mysqldbd 时间:2011-04-01 17:49:35 0 删除 编辑
If you have UNIQUE constraints on secondary keys, you can speed up table imports by temporarily turning off the uniqueness checks during the import session:

SET UNIQUE_CHECKS=0;
... import operation ...
SET UNIQUE_CHECKS=1;

For big tables, this saves a lot of disk I/O because InnoDB can use its insert buffer to write secondary index records in a batch. Be certain that the data contains no duplicate keys. UNIQUE_CHECKS allows but does not require storage engines to ignore duplicate keys.

If you have FOREIGN KEY constraints in your tables, you can speed up table imports by turning the foreign key checks off for the duration of the import session:

SET FOREIGN_KEY_CHECKS=0;
... import operation ...
SET FOREIGN_KEY_CHECKS=1;

For big tables, this can save a lot of disk I/O.

这里面最后的 set XXX=1; 能加上原来的约束吗?

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25267658/viewspace-691486/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-01-19

  • 博文量
    35
  • 访问量
    81673