当前位置:网站首页>Why disable foreign key constraints
Why disable foreign key constraints
2022-04-23 15:39:00 【dengk2013】
【 Ali JAVA standard 】 : Do not use foreign keys and cascades , All foreign key concepts must be solved in the application layer
Why Alibaba stipulates so ?
1. Every time I do DELETE perhaps UPDATE Must consider foreign key constraints , It can lead to painful development , The test data is extremely inconvenient , That is, when inserting a master record , At this time, the foreign key corresponding to the master record , You must also delete or update , Another example is a tester doing a stress test 1000W data , At the same time, the corresponding foreign key record table should also be stored 1000W, You need to build 2000W data , Increase the workload
2. Performance issues : For records containing primary key tables , Need warehousing 2 A watch
3. Concurrency issues : Foreign key constraints enable row level locks When the main table is written, it will enter blocking , For example, there are foreign keys in order details and order total , When adding order details , However, if the write operation of the total order table is not completed, the details will be blocked , Threads are always overstocked, resulting in mysql collapse .
4. Cascade deletion problem : Multiple cascading deletions can make data uncontrollable ; Triggers are also strictly disabled
5. Data coupling : Coupling of data relations at the database level Data migration and maintenance are difficult
6. If mysql The data reached 100 More than hundred million , Data migration is required at this time , For example, migrate to hbase, because hbase There is no relationship between primary and foreign keys , There is no checking of the relationship between main and foreign keys in program , There is no guarantee of data consistency in the migration process
版权声明
本文为[dengk2013]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231537380128.html
边栏推荐
- Upgrade MySQL 5.1 to 5.66
- What role does the software performance test report play? How much is the third-party test report charged?
- IronPDF for .NET 2022.4.5455
- Hj31 word inversion
- Detailed explanation of MySQL connection query
- utils.DeprecatedIn35 因升级可能取消,该如何办
- 导入地址表分析(根据库文件名求出:导入函数数量、函数序号、函数名称)
- 电脑怎么重装系统后显示器没有信号了
- 删除字符串中出现次数最少的字符
- G007-HWY-CC-ESTOR-03 华为 Dorado V6 存储仿真器搭建
猜你喜欢
Deep learning - Super parameter setting
cadence SPB17. 4 - Active Class and Subclass
Mysql database explanation (IX)
考试考试自用
Cookie&Session
网站压测工具Apache-ab,webbench,Apache-Jemeter
WPS品牌再升级专注国内,另两款国产软件低调出国门,却遭禁令
Detailed explanation of kubernetes (XI) -- label and label selector
What if the server is poisoned? How does the server prevent virus intrusion?
G007-hwy-cc-estor-03 Huawei Dorado V6 storage simulator construction
随机推荐
T2 iCloud日历无法同步
MySQL InnoDB transaction
自动化测试框架常见类型▏自动化测试就交给软件测评机构
How to test mobile app?
JVM-第2章-类加载子系统(Class Loader Subsystem)
JSON date time date format
PHP classes and objects
机器学习——逻辑回归
Educational codeforces round 127 A-E problem solution
kubernetes之常用Pod控制器的使用
Common types of automated testing framework ▏ automated testing is handed over to software evaluation institutions
计算某字符出现次数
Deeply learn the skills of parameter adjustment
推荐搜索 常用评价指标
负载均衡器
Elk installation
PHP PDO ODBC loads files from one folder into the blob column of MySQL database and downloads the blob column to another folder
s16.基于镜像仓库一键安装containerd脚本
提取不重复的整数
Mysql database explanation (IX)