创建新数据库时
我有一个一般的数据库设计问题:什么时候创建新数据库而不是向现有数据库添加新表更好?这个问题与设计/可维护性以及性能问题有关。
背景:我们通过每天晚上将数据导入到名为 RM2 的数据库中来镜像客户的主表。一些新的(ASP.Net-)项目也需要访问这些数据,现在我想知道是否应该为每个项目创建新的数据库或将它们的表与 RM2 合并(当前大小:37991.94 MB)。
I have a general Database Design question: When is it better to create a new Database instead of adding new Tables to an existing? The question is related to design/maintainability andalso performance issues.
Background: we are mirroring the main tables of our customer by importing the data every night into our DB called RM2. Some new (ASP.Net-)Projects need access to this data too, now i'm wondering if i should create new databases for each project or merge their tables with the RM2(current size: 37991.94 MB).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这不是数据库设计问题。这是一个组织问题。这个问题的组织方面比技术问题重要得多。
答案是:任何让你作为开发人员的生活最轻松的事情
例如,你说:
这些项目与您的项目的整合程度如何?您实际上共享数据(或写入相同的表)吗?例如,如果您对其中一个表进行了重大更改,是否需要同时更改其他项目中的代码? (有时两个项目之间很难同步)。
如果您实际上并不共享数据(除了客户数据,我认为这些数据实际上是只读的),则使用单独的数据库(或模式)。这使得变更更容易管理。
另一个技巧是在每个数据库中拥有一组客户数据视图,这些数据位于另一个模式的其他地方。
因此,每个项目都有一个数据库,每个数据库中都有客户数据的视图,这些数据位于一个单独的数据库中。
性能实际上不应该成为问题,除非数据库位于不同的计算机上。
This isn't a database design question. This is an organisational question. The organisational aspects of this question are much more important than technical questions.
The answer is: whatever makes life easiest for you as developers
For instance, you say:
How integrated are these projects with your project? Do you actually share data (or write to the same tables)? For instance, if you make a breaking change to one of your tables, do you need to make changes to the code in the other projects at the same time? (Sometimes really hard to synchronize between two projects).
If you don't actually share data (apart from the customer data, which I assume is effectively read-only), then use separate databases (OR schemas). This makes changes a lot easier to manage.
Another trick is to have in each database a set of views onto the customer data, which lives in elsewhere, in another schema.
So, have a database per project, with views in each database onto the customer data, which lives in a single separate database.
Performance shouldn't really be an issue, unless the databases live on separate machines.
如果任何项目只想使用自己的数据库,您可以为项目获取其他数据库。但如果你想获得这个数据中心,你应该为每个项目创建一个其他共享数据库+自数据库。
You can get other database for projects if any project want use only self database. But if you want get datacenter of this you should create for it a other shared database + self database for each project.
我不一定会回答您的问题,但我也会给您提供一些其他问题供您考虑:
我想这可能已经回答了你的一些问题。 ;-)
I won't necessarily answer your question, but I'll give you a bunch of other questions to consider as well:
I guess that may have answered your question some. ;-)