Database vertical segmentation, HORIZONTAL segmentation

Source: Internet
Author: User
Tags one table

Database vertical segmentation, HORIZONTAL segmentation

I have found that share:

Sometimes partitioning a table can improve performance. There are two ways to split a table:
1 Horizontal segmentation: Place data rows into two separate tables based on the values of one or more columns of data.
Horizontal splits are usually used in the following situations.
The table is large, the split can reduce the number of data to read in the query and index pages, but also reduce the index layer, improve query speed.
The data in the table is inherently independent, for example, in tables where data from each region is recorded, or in different periods of time, especially when some data is commonly used, and some other data is not used.
? You need to store the data on multiple media.
Horizontal segmentation adds complexity to the application, which typically requires multiple table names when querying, and the union operation is required to query all data. In many database applications, this complexity can outweigh the benefits, because as long as the index key is small, when the index is used for querying, the table adds two to three times times the amount of data, and the query increases the number of disks that read an index layer.
2 Vertical split: Place the main code and some columns in one table, and then place the main code and another column in another table.
If some columns in a table are commonly used, while others are less common, vertical segmentation can be used, and vertical segmentation can make data rows smaller, a data page can hold more data, and the number of I/O times will be reduced when querying. The disadvantage is that you need to manage redundant columns, and querying all data requires a JOIN operation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.