Reproduced original Address http://blog.csdn.net/bluishglc/article/details/6274841
The granularity of vertical slicing refers to the level of association tables that are allowed to be placed in a shard when vertical slicing is done. This problem has a great impact on application and sharding implementations.
The more association interrupts, the more the affected join operations, the greater the compromise the application makes, but the simpler the single-table routing and the smaller the association with the business, the easier it will be to use a uniform mechanism for processing. The extreme scenario in this direction is to interrupt all connections, each with a routing rule that can be handled automatically using a uniform mechanism or framework. For example, a framework such as amoeba, its routing can and can only be routed through the characteristics of SQL (such as a table ID).
Conversely, if the association interrupts less, then the join operation is limited, the application needs to make a compromise less, but the table routing will become complex, and the greater the relevance of the business, the more difficult to use the uniform mechanism processing, the need for each data request to implement a separate route. The extreme scenario in this direction is that all tables are in a shard, that is, there is no vertical slicing, so no association is interrupted. Of course this is very extreme, unless the entire database is simple and the number of tables is small.
The actual granularity of the control needs to be combined with "business tightness" and "tabular data volume" Considerations in general:
- If the table is grouped together tightly, and the amount of data is not large, the growth rate is very slow, it is appropriate to put in a shard, do not need to do horizontal segmentation;
- If the amount of tabular data is large and rapid growth, it is bound to the vertical segmentation on the basis of the horizontal segmentation, horizontal segmentation means that the original single shard will be subdivided into a number of smaller Shard, Each shard has a primary table (that is, a table that will be hashed with that table ID) and associated tables with multiple phases.
In a word, the granularity of vertical slicing presents the advantages and disadvantages in two opposite directions and the mutual game. What architects need to do is to balance the benefits of the project with the best of both worlds.
On the grain size of vertical splitting vertical sharding