有很多列的表 [英] Table with a lot of columns

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

问题描述

如果我的表中有大量的列(超过80个),我应该将其拆分为具有一对一关系的几个表,还是保持原样?为什么?我主要关心的是性能.

If my table has a huge number of columns (over 80) should I split it into several tables with a 1-to-1 relationship or just keep it as it is? Why? My main concern is performance.

PS-我的桌子已经是第3张标准格式.

PS - my table is already in 3rd normal form.

PS2-我正在使用MS Sql Server 2008.

PS2 - I am using MS Sql Server 2008.

PS3-我不需要一次访问所有表数据,而是在该表中拥有3个不同类别的数据,我分别对其进行访问.它类似于:会员首选项,会员帐户,会员资料.

PS3 - I do not need to access all table data at once, but rather have 3 different categories of data within that table, which I access separately. It is something like: member preferences, member account, member profile.

推荐答案

80列实际上并不多...

80 columns really isn't that many...

从性能的角度来看,我不会担心.拥有一个表(如果通常在标准操作中使用所有数据)可能会胜过具有1-1关系的多个表,尤其是在索引适当的情况下.

I wouldn't worry about it from a performance standpoint. Having a single table (if you're typically using all of the data in your standard operations) will probably outperform multiple tables with 1-1 relationships, especially if you're indexing appropriately.

不过,从维护的角度来看,我会为此担心(可能).单个表中的数据列越多,该表在大方案中的作用就越难以理解.另外,如果您通常只使用一小部分数据,并且并非总是需要全部80列,那么将其拆分为2个以上的表可能会提高性能.

I would worry about this (potentially) from a maintenance standpoint, though. The more columns of data in a single table, the less understandable the role of that table in your grand scheme becomes. Also, if you're typically only using a small subset of the data, and all 80 columns are not always required, splitting into 2+ tables might help performance.

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

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