数据分片

    • 支持查询所有数据分片规则和指定表查询
    • 支持查询所有分片算法

    Sharding Binding Table Rule

    Sharding Broadcast Table Rule

    Sharding Algorithms

    Sharding Binding Table Rule

    Sharding Table Rule

    1. mysql> show sharding table rules;
    2. +--------------+---------------------------------+-------------------+----------------------+------------------------+-------------------------------+----------------------------------------+-------------------+---------------------+----------------------------+---------------------------------------------------+-------------------+------------------+-------------------+
    3. | table | actual_data_nodes | actual_data_sources | database_strategy_type | database_sharding_column | database_sharding_algorithm_type | database_sharding_algorithm_props | table_strategy_type | table_sharding_column | table_sharding_algorithm_type | table_sharding_algorithm_props | key_generate_column | key_generator_type | key_generator_props |
    4. +--------------+---------------------------------+-------------------+----------------------+------------------------+-------------------------------+----------------------------------------+-------------------+---------------------+----------------------------+---------------------------------------------------+-------------------+------------------+-------------------+
    5. | t_order | ds_${0..1}.t_order_${0..1} | | INLINE | user_id | INLINE | algorithm-expression:ds_${user_id % 2} | INLINE | order_id | INLINE | algorithm-expression:t_order_${order_id % 2} | order_id | SNOWFLAKE | worker-id:123 |
    6. | t_order_item | ds_${0..1}.t_order_item_${0..1} | | INLINE | user_id | INLINE | algorithm-expression:ds_${user_id % 2} | INLINE | order_id | INLINE | algorithm-expression:t_order_item_${order_id % 2} | order_item_id | SNOWFLAKE | worker-id:123 |
    7. 3 rows in set (0.02 sec)
    1. mysql> show sharding algorithms;
    2. +-------------------------+--------+-----------------------------------------------------+
    3. | name | type | props |
    4. +-------------------------+--------------------------------------------------------------+
    5. | t_order_inline | INLINE | algorithm-expression=t_order_${order_id % 2} |
    6. | t_order_item_inline | INLINE | algorithm-expression=t_order_item_${order_id % 2} |
    7. 2 row in set (0.01 sec)

    Sharding Binding Table Rule

    1. mysql> show sharding broadcast table rules;
    2. +------------------------+
    3. | sharding_broadcast_tables |
    4. +------------------------+
    5. | t_1 |
    6. | t_2 |