当前位置:网站首页>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
边栏推荐
- Verilog splicing operation symbol
- HB5470民用飞机机舱内部非金属材料燃烧测试
- Activemq消息组件发布订阅ReDelivery消息重新投递
- Verilog shift operator
- 【To .NET】C#数据模型,从Entity Framework Core到LINQ
- ServerApp. iopub
- Verilog data type
- Wechat applet sub components transfer values to the page (communication between parent and child components) with source code
- Abstract classes and interfaces
- Network learning of pointnet
猜你喜欢

First electric shock, so you are such a dragon lizard community | dragon lizard developer said that issue 8

【To .NET】C#数据模型,从Entity Framework Core到LINQ

Keras to tf Vgg19 input in keras_ shape

Unity C # e-learning (12) -- protobuf generation protocol

Detecting and counting tiny faces

YOLACT实时实例分割

Let's make a summary

手写VirtualDOM

两阶段目标检测原理详细版

Scenario analysis of deadlock during MySQL insert
随机推荐
基于区域注意的通用目标检测
Record the field name dynamically modified by SetData of wechat applet
Yolo nano: a highly compact one look convolutional neural network for target detection
[target detection] | indicator a probabilistic challenge for object detection
CMD enter virtual machine
Remember to customize the top navigation bar of wechat applet
实例报错IOPub data rate exceeded
Verilog 表达式
MySQL virtual column
微信小程序最新canvas2d手写签名
Wechat applet project: tab navigation bar
Twinmotion 初学者教程
Universal target detection based on region attention
Wechat applet jump to official account image and text content
微信小程序搜索关键字高亮和ctrl+f搜索定位实现
NPM common commands
Debugging H5 page -weinre and spy debugger real machine debugging
Verilog splicing operation symbol
Product manager certification enrollment brochure (NPDP) in July 2022
Verilog 大小端以及 +:使用