简体   繁体   English

列的MySql数和参数大小会影响性能

[英]MySql number of columns and parameter size affect on performance

I have looked at similar questions such as this one Does number of columns affect MYSQL speed? 我看过类似的问题,例如这一列是否会影响MYSQL的速度?

I will try to ask my question with more specification as it is slightly different. 我会尝试用更多的规范来提问我的问题,因为它略有不同。

I have the option of having a table like this; 我可以选择这样的桌子;

UserID | Parameter 1 | Parameter 2

The table will NOT have any relational SQL performed on it. 该表不会对其执行任何关系SQL。 The queries will only read/write Parameter 1 OR Parameter 2 for a group of UserIDs. 查询将仅读取/写入一组UserID的参数1或参数2。
Parameter 1 will be required more than 10 times as often as Parameter 2 参数1的频率是参数2的10倍

Parameter 1 will store a data string of up to 1000 characters 参数1将存储最多1000个字符的数据字符串
Parameter 2 will store a data string of up to 100000 characters 参数2将存储最多100000个字符的数据字符串

I have a choice of format for these so I think TEXT(1000) or Blob for Parameter 1 and MEDIUMTEXT(100000) or MEDIUMBLOB for Parameter 2 would be valid. 我可以选择这些格式,所以我认为参数1和MEDIUMTEXT(100000)的TEXT(1000)或Blob或参数2的MEDIUMBLOB都是有效的。 Note I just need to read/write these - I am not sure what the format choice would do to DB performance (minor question). 注意我只需要读/写这些 - 我不确定格式选择对DB性能的影响(次要问题)。

My main question is this; 我的主要问题是这个; given the frequency of access to Parameter 1 and Parameter 2, the independence of the Parameters, and given the much greater size of Parameter 2, should I have one table; 给定参数1和参数2的访问频率,参数的独立性,以及参数2的大小,我应该有一个表;

UserID | Parameter 1 | Parameter 2

OR two tables; 或两个表;

UserID | Parameter 1 
UserID | Parameter 2

This is an edit to make things clearer. 这是一个让事情更清晰的编辑。 I am interested in the performance difference of the two table options given the previous description. 我对前面描述的两个表选项的性能差异感兴趣。 I am especially concerned that the inclusion of the larger and less used Parameter 2 will have a significant impact on the performance when accessing Parameter 1. You may consider that the effect if there are 1000s of rows. 我特别担心的是,当访问参数1时,包含较大且较少使用的参数2将对性能产生重大影响。如果存在1000行,则可以考虑效果。

Premature optimization. 过早优化。 Go with whichever is easier from a programming viewpoint. 从编程角度来看更容易。

Obsessing over a little detail like this will just cause you to lose time you could actually be implementing your program. 对这样的一些细节进行痴迷只会让你失去实际执行程序的时间。

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

相关问题 数据库中的大量表(尽管大小)会影响mysql查询的性能吗? - Will a large number of tables (although of small size) in a database affect the performance of mysql queries? 在MySQL中,TEXT或BLOB的指定大小是否会影响性能或表大小? - In MySQL, does the designated size of TEXT or BLOB affect performance or table size? 列数会影响MYSQL速度吗? - Does number of columns affect MYSQL speed? 列数不会影响数据库性能,行数会影响数据库性能吗? - Is it true that columns number does not affect database performance but rows number does? Mysql:字段大小/显示宽度是否影响索引性能? - Mysql: Does field size/display width affect index performance? 表中的列数是否会影响没有索引的表上的count(*)查询的性能? - Does number of columns in a table affect the performance of a count(*) query on a table with no indexes? MySQL / mariadb innodb:行大小是否会影响复杂的查询性能? - Mysql/mariadb innodb: does row size affect complex query performance? 使用order by时,数字的长度是否会影响mysql的性能? - Does the length of a number affect performance in mysql when using order by? MySql中的性能瓶颈:行数或文件大小? - Performance bottleneck in MySql: number of rows or size of file? 在MySQL上使用IN代替OR影响性能 - use IN instead OR on mysql affect performance
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM