mysql 主键唯一,MySQL。关键表中的主键。唯一ID还是多个唯一键?
Primary key in relational tables. Composite primary key or unique primary key in those pure relational tables?
Which design would you recommend to use in MySQL for high performance? See diagram
Technical advantages and disadvantages!
Thanks everyone!
解决方案
It really depends on the type of query you're doing...
If you add an extra surrogate, you'll end up doing two unique checks instead of a single one for every insert, update and delete. That makes the composite key sound right.
But if you're constantly referencing that primary key in other foreign keys, the composite option means you end up storing twice as much information and need to do more work when joining. That makes the single key sound right.
创作挑战赛新人创作奖励来咯,坚持创作打卡瓜分现金大奖总结
以上是生活随笔为你收集整理的mysql 主键唯一,MySQL。关键表中的主键。唯一ID还是多个唯一键?的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: mysql架设_主从mysql架设
- 下一篇: ibatis 数据库获取不到 java_