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 - 多少列太多了?


基础教程推荐
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01