Mysql数据库常用分库和分表方式_MySQL
1 分库
1.1 按照功能分库
按照功能进行分库。常见的分成6大库:1 用户类库:用于保存了用户的相关信息。例如:db_user,db_system,db_company等。
2 业务类库:用于保存主要业务的信息。比如主要业务是笑话,用这个库保存笑话业务。例如:db_joke,db_temp_joke等。
3 内存类库:主要用Mysql的内存引擎。前台的数据从内存库中查找,速度快。例如:heap。
4 图片类库:主要保存图片的索引以及关联。例如:db_img_index,db_img_res。
5 日志类库:记录点击,刷新,登录等日志信息。例如:db_log_click,db_log_fresh,db_log_login。
6 统计类库:对业务的统计,比如点击量,刷新量等等。例如db_stat。
1.2 安装城市站分库
如果业务遍布全国,在按照功能分库库,每一个城市复制一份一模一样的库,只是库后缀都是城市名称。比如db_log_click_bj,db_log_click_tj,db_log_click_sh;2 分表
2.1 按照用户或业务的编号分表
对与用户或业务可以按照编号%n,进行分成n表。例如:笑话表。
tb_joke_01,tb_joke_02,tb_joke_03,tb_joke_04........
2.2 按照日期分表
对于日志或统计类等的表。可以按照年,月,日,周分表。例如 点击量统计。
tb_click_stat_201601,tb_click_stat_201602,tb_click_stat_201603
3 Mysql数据库常用架构
核心:一主多从,读写分离。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Explore the Canvas framework: To understand what are the commonly used Canvas frameworks, specific code examples are required. Introduction: Canvas is a drawing API provided in HTML5, through which we can achieve rich graphics and animation effects. In order to improve the efficiency and convenience of drawing, many developers have developed different Canvas frameworks. This article will introduce some commonly used Canvas frameworks and provide specific code examples to help readers gain a deeper understanding of how to use these frameworks. 1. EaselJS framework Ea

Spring is an open source framework that provides many annotations to simplify and enhance Java development. This article will explain commonly used Spring annotations in detail and provide specific code examples. @Autowired: Autowired @Autowired annotation can be used to automatically wire beans in the Spring container. When we use the @Autowired annotation where dependencies are required, Spring will find matching beans in the container and automatically inject them. The sample code is as follows: @Auto

With the development of the Internet, data security has become a serious issue that we must pay attention to in our daily work. Encryption becomes especially important when it comes to sensitive personal information or business data. In PHP development, some encryption algorithms are widely used. Let's take a look at the encryption algorithms commonly used in PHP. 1. Base64 encoding Base64 encoding is often used to transmit binary data in web pages or emails, because web pages or emails can only transmit string type data and cannot directly transmit binary data. Base64 is a solution

In-depth analysis of the top 15 Bitcoin Escape Index: Market Outlook for 2025 This article deeply analyzes fifteen commonly used Bitcoin Escape Index, among which the Bitcoin Rhodl ratio, USDT current wealth management and altcoin seasonal index have reached the Escape Index in 2024, attracting market attention. How should investors deal with potential risks? Let us interpret these indicators one by one and explore reasonable response strategies. 1. Detailed explanation of key indicators AHR999 coin hoarding indicator: Created by ahr999, assisting Bitcoin fixed investment strategy. The current value is 1.21, which is in the wait-and-see range, so it is recommended to be cautious. Link to AHR999 Escape Top Indicator: A supplement to AHR999 Coin Hoarding Indicator, used to identify the top of the market. The current value is 2.48, this week

What are the commonly used functions in Go language? ——Explore commonly used functions and their usage in Go language. As a popular statically typed programming language, Go language is widely used in various fields, such as server-side development, network programming, cloud computing, etc. In the Go language, functions, as the basic code organization unit, are an important part of program running. This article will explore the commonly used functions and their usage in the Go language to help readers better grasp the core features of this language. 1. Function declaration and calling functions in Go language with the keyword "fun

Oracle database is a commonly used relational database management system that supports multiple data types to meet different needs. When using Oracle database, it is very important to understand the data types of the database. This article will introduce the commonly used data types in Oracle database, with specific code examples. 1. Numeric data type NUMBERNUMBER is the most commonly used numeric data type in Oracle database, used to store integers or floating point numbers. The NUMBER data type can specify precision

As the amount of data increases, the traditional single-table storage method can no longer meet the needs of big data, and table partitioning has become a common solution. In MongoDB, how to implement database table partitioning? This article will give the implementation method of MongoDB database table partitioning based on PHP. 1. Introduction to MongoDB database Before introducing the method of splitting tables in MongoDB database, let’s first understand the relevant knowledge of MongoDB database. MongoDB is a NoSQL database that uses document storage. and

The field of software development has changed dramatically over a long period of time, and DevOps has become an essential part of the modern computer program delivery process. To streamline the process of developing and operating computer programs, DevOps fosters a culture of collaboration, continuous integration, and non-stop delivery. The choice of programming language plays an important role in efficient utilization of DevOps, and two well-known contenders in this field are Ruby and Python. Here, we’ll look at the choice, popularity, and use cases of Ruby and Python in DevOps environments. We'll investigate their unique features, advantages, and disadvantages to help you decide which language is best for your DevOps needs. Section 1: Ruby and Python
