As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center 指导。




8年前关闭。




我正在构建一个 Web 应用程序,我想从一开始就让它扩展。我对数据库可扩展性不是很感兴趣,我正面临着这样的疑问:

我应该使用具有数百万行的少数表,还是应该将内容拆分为数百个表(如果不是数千个具有预期数百行的表)。

我可以走两种路线,但我不知道从长远来看,哪一种会更好地扩展。

我找到了一些关于这个踏板的信息,但它没有多大帮助:MySQL Whats better for speed one table with millions of rows or managing multiple tables?

基本上我需要知道,垂直或水平扩展数据库更好?

最佳答案

如果查询调整得好,数据库将提供足够快的响应,查询的微小调整可能会带来速度的神奇变化。

但是,您不想要数据库方面的讲座。对于您的问题:这里最重要的是实现规范化形式。

你的表应该是可管理的并且没有 redundancy 。为避免冗余,您需要尽可能多地 normalize 您的表。规范化形式高达 6NF,但我认为 Boyce–Codd normal form 应该足够了,如果您在该领域没有经验。

关于MySQL:更好的几百万行表或几千行数百行的表,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14298932/

10-12 01:13