Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Standard] Scene表和Level表的对应关系 #10

Open
i6bimua opened this issue Mar 22, 2024 · 0 comments
Open

[Standard] Scene表和Level表的对应关系 #10

i6bimua opened this issue Mar 22, 2024 · 0 comments
Labels
standard Standards for development

Comments

@i6bimua
Copy link

i6bimua commented Mar 22, 2024

在我们的项目中,最终决定用关系表的方式去存储Scene_id与Level_id的对应关系
具体来说就是新建了一个表connect来存储Level_id和对应的Scene_id
相比较逻辑外键储存有以下几点优势:

  1. 数据更加规范,避免了数据的冗余
  2. 对于复杂关系的处理更加灵活,便于扩展和维护
  3. 运行效率更高,由于外键需要加锁,会大大影响并发的效率,使数据库的性能下降明显,同时容易出现死锁等问题,并且外键的curd速度较慢
  4. 数据更加完整,把场景与关卡之间的关系抽象成一个关系表,更容易控制、插入、删除、更新这些关系。同时不对两个实体表进行修改,有更小的重合度,代码更加独立完整,符合逻辑
  5. 有利于架构的可扩展性以及可能发生的重构,也减少了发生bug的概率

这次更新已经创建了实例,更新了数据库成员

@i6bimua i6bimua added the standard Standards for development label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
standard Standards for development
Projects
None yet
Development

No branches or pull requests

1 participant