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.
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的mysql 主键唯一,MySQL。关键表中的主键。唯一ID还是多个唯一键?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql架设_主从mysql架设
- 下一篇: 最拼爹的css属性:z-index失效情