mysql - how many columns is too many?(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 - 多少列太多了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:mysql - 多少列太多了?
				
        
 
            
        基础教程推荐
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
 - MySQL 5.7参照时间戳生成日期列 2022-01-01
 - 从字符串 TSQL 中获取数字 2021-01-01
 - 带更新的 sqlite CTE 2022-01-01
 - 带有WHERE子句的LAG()函数 2022-01-01
 - ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
 - while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
 - 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
 - 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
 - CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
 
    	
    	
    	
    	
    	
    	
    	
    	
						
						
						
						
						
				
				
				
				