简体   繁体   English

平均行长mysql是否会影响其性能?

[英]Does average row length mysql affect its performance?

Should I be worried about keeping many columns in a single row? 我应该担心将多列保持在一行中吗? or is that non issue for performance? 还是这不是性能问题?

Be (slightly) worried. (略)担心。 The larger the tow size, the fewer rows can fit on a page of disk, so performance will suffer as row length goes up. 拖曳大小越大,磁盘页面上可容纳的行数越少,因此,当行长增加时,性能会受到影响。

But don't change your design early on to avoid long rows - do what's right then worry about it if it becomes a problem. 但是,请勿尽早更改设计以免排得太长-做正确的事,然后在出现问题时担心它。 Changing your design purely to avoid future "performance problems" would be *opimizing early", which is a deadly sin. 纯粹为了避免将来的“性能问题”而更改设计会“尽早优化”,这是致命的罪过。

How many is 'many'? “很多”是多少? If you have a lot of NULLs because that particular column isn't needed then it can be more efficient to normalise the database into more tables with less NULL data points. 如果由于不需要该特定列而有很多NULL,则将数据库规范化为具有更少NULL数据点的更多表会更有效。 But it shouldn't matter too much. 但这不应该太重要。

I am using 2 tables to store user profilea. 我正在使用2个表来存储用户配置文件。

  1. full one 全一

  2. users_mem, stored in MySql memory with 6 cols: id, username, gender, chat? users_mem,以6列存储在MySql内存中:id,用户名,性别,聊天? pbs? 铅?

the most queries do not need more than user ID and name/nickname and sometimes gender. 大多数查询只需要用户ID和名称/昵称,有时还需要性别。

chat & pbs = If these cols is zero, I do not need to lookup in my heavy tables if the user has a new messages. chat&pbs =如果这些cols为零,如果用户有新消息,则无需在我的重表中查找。

works perefect with heavy system. 在完美的系统上工作完美。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM