mysql-多少列太多? [英] mysql - how many columns is too many?

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

问题描述

我正在建立一个可能有70列以上的表格.我现在正在考虑将其拆分,因为每次访问表时都不需要列中的某些数据.再说一次,如果我这样做,我将不得不使用联接.

I'm setting up a table that might have upwards of 70 columns. I'm now thinking about splitting it up as some of the data in the columns won't be needed every time the table is accessed. Then again, if I do this I'm left with having to use joins.

在什么时候(如果有的话)被认为列太多?

At what point, if any, is it considered too many columns?

推荐答案

一旦超过您不需要每个查询都返回所有列的事实是完全正常的;这就是为什么SELECT语句可让您显式命名所需的列的原因.

The fact that you don't need every column to be returned by every query is perfectly normal; that's why SELECT statement lets you explicitly name the columns you need.

作为一般规则,您的表结构应反映您的域模型;如果确实有70个(属于100个实体)属于同一实体的属性,则没有理由将它们分成多个表.

As a general rule, your table structure should reflect your domain model; if you really do have 70 (100, what have you) attributes that belong to the same entity there's no reason to separate them into multiple tables.

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

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