当前位置:网站首页>Mysql database and table splitting strategy and application scenarios
Mysql database and table splitting strategy and application scenarios
2022-06-29 09:19:00 【amateur12】
sub-treasury
Solve the performance problem of a single database
Horizontal sub database : modulus
Determine how many libraries the data needs to be evenly distributed , That is to say : Storage capacity
For users ID Take the mold ,user_id% Storage capacity , The result is 0 In the first library , The result is 1 In the second library ...
Vertical sub database : Split according to business
When there is too much order data, a separate database can be created for the order
table
Solve the query performance problem of single table massive data
Horizontal sub table
Split data in behavioral units
After the sub table , The structure of all tables is the same
Solve the problem of too much table data
Method : Determine how many tables the data needs to be evenly distributed , That is to say : Table capacity
For users ID Take the mold ,user_id% Table capacity , The result is 0 In the first table , The result is 1 In the second table ...
Vertical sub table
Split into multiple tables by column , Multiple tables are associated through primary keys , So as to form a complete data
After the sub table , The structure of each table is different
Solve the problem of too many columns
Simultaneous database and table
Intermediate variable = user_id%( Storage capacity * Table capacity per library )
Library number = integer ( Intermediate variable / Table capacity per library )
Table number = Intermediate variable % Table capacity per library
disadvantages
Originally, things across tables have become distributed things ;
Because records are segmented into different databases and different data tables , It is difficult to perform multi table Association query , And query the library number and table number of the data to be specified .
Further expand the system ( Change of warehouse number and table number ), Will become very inconvenient , We need to re migrate data .
How much data scale is appropriate
theory 500w Separable table ( It is faster after the table is divided )
actual 1000w-2000w Left and right can be divided into two parts
In short, it should not exceed 5000w Talent score table ,5000w Is the index limit
Add : If the order data needs to be counted , Statistics of monthly sales and other information , You can use a monthly schedule , otherwise , Don't suggest , Because there may be too many data in a certain month , However, there are few data in a certain month
边栏推荐
猜你喜欢

Handwritten virtualdom

Share code snippets of wechat applet

Open3D 最远点采样(FPS)

What is the difference between hyperconverged architecture and traditional architecture?

什么是超融合?与传统架构有什么区别?.

July 2022 (advanced soft test) information system project manager certification enrollment Brochure

Detecting and counting tiny faces

MT yolov6 training and testing

What is hyperfusion? What is the difference with traditional architecture

ActiveMQ message component publish subscribe redelivery message redelivery
随机推荐
查找字符串中重复次数最多的元素
Unity C # e-learning (12) -- protobuf generation protocol
Keras to tf Vgg19 input in keras_ shape
什么是超融合?与传统架构有什么区别?.
LFFD:一种用于边缘检测的轻量化快速人脸检测器
宏,函数和内联函数
Share code snippets of wechat applet
Written test question "arrange version numbers from large to small"
ISO16000-9建筑产品和家具中挥发性有机物的测试
训练查看(问题暂存)
July 2022 (advanced soft test) information system project manager certification enrollment Brochure
Scenario analysis of deadlock during MySQL insert
微信小程序判断url的文件格式
【数据集】|标注的bbox影响 Can we trust bounding box annotations for object detection
pytorch学习总结—运算的内存开销
Picture format -webp
图片格式-webp
GPU training cloud platform record
YOLACT实时实例分割
SSD改進CFENet