多少列是多少列? [英] How many columns is too many columns?

查看:172
本文介绍了多少列是多少列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到很多人在这里引用了一个表中有20多个(我看过多达55个)列的表。现在我不假装是一个数据库设计专家,但我一直听说这是一个可怕的做法。当我看到这一点,我通常建议分成两个表与一对一的关系:一个包含最常用的数据,另一个与最不常用的数据。虽然同时,有可能的性能问题(更少的JOIN等)。所以我的问题是这样的:

I've noticed that a lot of folks here cite tables with 20+ (I've seen as much as 55) columns in one table. Now I don't pretend to be a database design expert, but I've always heard that this is a horrible practice. When I see this, I usually suggest splitting into two tables with a one to one relationship: one containing the most frequently used data, the other with the least often used data. Though at the same time, there's the possible issue of performance (less JOINs and such). So my question is this:

当涉及到真正的LARGE规模的数据库,实际上有一个优势,有大量的列,尽管事实,到许多NULL值?

When it comes to really LARGE scale databases, is there actually an advantage to having a large amount of columns, despite the fact that this usually leads to many NULL values?

这是更多的性能命中:许多列有很多NULL或更少的列有很多JOIN?

Which is more of a performance hit: lots of columns with lots of NULLs, or fewer columns with lots of JOINs?

推荐答案

表的设计取决于它需要存储的实体。如果所有的数据属于一起,则50列(甚至100列)可能是正确的。

The design of the table depends on the entity it needs to store. If all the data belongs together, then 50 columns (or even 100) might be the correct thing to do.

只要表格正规化,除了数据库功能和需要优化之外,没有关于大小的经验法则。

So long as the table is normalized, there is no rule of thumb regarding size, apart from database capabilities and the need to optimize.

这篇关于多少列是多少列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆