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 临时表问题 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01