Logic table
Split level generic name database (table) and the data structure of the same logical table. Example: split the data according to the order of the mantissa primary key table 10, respectively, t_order_0
to t_order_9
their logical name table t_order
.
Real table
Physical fragmentation table database real. I.e., in the previous example t_order_0
to t_order_9
.
Data Node
Minimum unit slice data partition. And the data source name data tables, for example: ds_0.t_order_0
.
Binding table
It refers to the primary fragmentation consistent rules and child table. For example: t_order
tables and t_order_item
tables, in accordance with order_id
fragmentation, this two mutually binding relationship table. Correlation between the binding table multi-table queries will not appear Cartesian product association, the association will greatly enhance query efficiency. For example, if SQL is:
SELECT i.* FROM t_order o JOIN t_order_item i ON o.order_id=i.order_id WHERE o.order_id in (10, 11);
When the configuration is not binding table relationship, assuming shard key order_id
the value of 0 to 10 routes, routing the value to the first sheet 11, then the SQL route should be 4, which is a Cartesian product presenting:
SELECT i.* FROM t_order_0 o JOIN t_order_item_0 i ON o.order_id=i.order_id WHERE o.order_id in (10, 11);
SELECT i.* FROM t_order_0 o JOIN t_order_item_1 i ON o.order_id=i.order_id WHERE o.order_id in (10, 11);
SELECT i.* FROM t_order_1 o JOIN t_order_item_0 i ON o.order_id=i.order_id WHERE o.order_id in (10, 11);
SELECT i.* FROM t_order_1 o JOIN t_order_item_1 i ON o.order_id=i.order_id WHERE o.order_id in (10, 11);
After configuring the binding relationship, routing SQL should be two:
SELECT i.* FROM t_order_0 o JOIN t_order_item_0 i ON o.order_id=i.order_id WHERE o.order_id in (10, 11);
SELECT i.* FROM t_order_1 o JOIN t_order_item_1 i ON o.order_id=i.order_id WHERE o.order_id in (10, 11);
Wherein t_order
the left most of FROM, ShardingSphere will use it as the master table entire binding table. All routes will be calculated using only the strategies of the main table, the t_order_item
table will be used to calculate the fragmentation t_order
conditions. Therefore, between the partition key binding table to be identical.
Broadcast table
Refers to a table, the table structure and data tables for all fragments in the data source are present they are identical in each database. It applies to the amount of data and the need to associate the scene of massive data query and tables, for example: dictionary table.