Home > Backend Development > PHP Tutorial > Will it affect performance if the operation of foreign keys in mysql is set to NO ACTION?

Will it affect performance if the operation of foreign keys in mysql is set to NO ACTION?

WBOY
Release: 2016-10-23 00:12:52
Original
1532 people have browsed it

RT, I just want to display the database structure more clearly in the database relationship diagram. As for the foreign key constraints, I will implement them in the code. Will setting both delete and update operations in the database to NO ACTION affect performance?

Reply content:

RT, I just want to display the database structure more clearly in the database relationship diagram. As for the foreign key constraints, I will implement them in the code. Will setting both delete and update operations in the database to NO ACTION affect performance?

The poster seems not to understand the respective functions of several foreign key constraints. Performance and not using foreign keys will certainly have an impact

<code>CASCADE #在父表上update/delete记录时,同步update/delete掉子表的匹配记录
SET NULL #在父表上update/delete记录时,将子表上匹配记录的列设为null 要注意子表的外键列不能为not null
NO ACTION #如果子表中有匹配的记录,则不允许对父表对应候选键进行update/delete操作  
RESTRICT #同no action, 都是立即检查外键约束</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template