哪个更好1表150,000,000,000行或5000表,30万行 [英] Which is better 1Table 150,000,000,000 rows or 5000 TABLES with 300,000 rows

查看:91
本文介绍了哪个更好1表150,000,000,000行或5000表,30万行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


将工作负载垂直分布到许多行会增加
的性能,而不是将工作负载水平分散到许多
表中



  • 包含150,000,000,000行和6列

table1(item_id,cat_id,note)
将存储将不断变化的非重复INT。

table1(item_id,cat_id,note)
The NOTE column will store a non repeating INT that will constantly be changing.

标准方式。


VS

The standard way.

VS


  • 5000个表格,包含300,000行和1,000列。

table1(id,cat_id,item_1,item_2,item_3,... item_999)table2(table1_id,id,cat_id,item_1000,item_1001,item_1002,... item_1998)
< br> ...

table5000(table1_id,id,cat_id,item_499000,item_499001,item_499002,... item_500000)

table1(id,cat_id,item_1,item_2,item_3,...item_999) table2(table1_id,id,cat_id,item_1000,item_1001,item_1002,...item_1998)
...
table5000(table1_id,id,cat_id,item_499000,item_499001,item_499002,...item_500000)

定义项目所在的每个类别。

该行将定义该类别中的每个项目。


从上面注释:将放置在相交的单元格中。

The column itself will define every category the item is in.
The Row will define every item in that category.

NOTE from above: will be placed in the intersected cell.

哪个更好?为什么? LINK /如果可能的话

Which is better? Why? LINKS if possible


  • 在搜索多个表格和单个表格时,是否存在巨大的性能滞后?


    • Is there a huge performance lag when searching multiple tables versus one single one?

    推荐答案

    Bytes per short string column 8,000
    
    Bytes per GROUP BY, ORDER BY 8,060
    
    Bytes per row 8,060
    
    Columns per index key 16
    
    Columns per foreign key 16
    
    Columns per primary key 16
    
    Columns per nonwide table 1,024
    
    Columns per wide table 30,000
    
    Columns per SELECT statement 4,096
    
    Columns per INSERT statement 4096
    
    Columns per UPDATE statement (Wide Tables) 4096
    

    这是mysql的限制

    When you combine varchar, nvarchar, varbinary, sql_variant, or CLR user-defined type columns that exceed 8,060 bytes per row, consider the following:
    

    是否正在构建实时应用程序?
    你真的想把关系分成表吗?
    ,你有关于属性的想法吗?
    你对数据库的想法是错误的

    are you building real time application ? do you have really idea about dividing relationships to tables? do you have idea about acid property? Your idea about database is wrong

    你只需要修改设计
    i我非常担心你的代码你将如何编码?

    请按照以下步骤操作



    • 进行一些分析

    • 并重新设计数据库,我认为您会真正获得良好的输出。

    最大行的列数为100,这更多来自我的pointof视图,所以我将列分成17表

    http: //www.slideshare.net/ronaldbradford/top20-design-tips-for-mysql-data-architects-presentation
    结帐此链接

    http://www.slideshare.net/ronaldbradford/top-20-design-tips-for-mysql-data-architects-presentation checkout this link

    这篇关于哪个更好1表150,000,000,000行或5000表,30万行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆