简体   繁体   中英

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. But it shouldn't matter too much.

I am using 2 tables to store user profilea.

  1. full one

  2. users_mem, stored in MySql memory with 6 cols: id, username, gender, chat? pbs?

the most queries do not need more than user ID and name/nickname and sometimes gender.

chat & pbs = If these cols is zero, I do not need to lookup in my heavy tables if the user has a new messages.

works perefect with heavy system.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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