数据分片

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

    Sharding Binding Table Rule

    Sharding Broadcast Table Rule

    Sharding Binding Table Rule

    Sharding Broadcast Table Rule

    1. mysql> show sharding table rules;
    2. +--------------+---------------------------------+-------------------+----------------------+------------------------+-------------------------------+----------------------------------------+-------------------+---------------------+----------------------------+---------------------------------------------------+-------------------+------------------+-------------------+
    3. | table | actualDataNodes | actualDataSources | databaseStrategyType | databaseShardingColumn | databaseShardingAlgorithmType | databaseShardingAlgorithmProps | tableStrategyType | tableShardingColumn | tableShardingAlgorithmType | tableShardingAlgorithmProps | keyGenerateColumn | keyGeneratorType | keyGeneratorProps |
    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. | t2 | | ds_0,ds_1 | | | | | mod | id | mod | sharding-count:10 | | | |
    7. +--------------+---------------------------------+-------------------+----------------------+------------------------+-------------------------------+----------------------------------------+-------------------+---------------------+----------------------------+---------------------------------------------------+-------------------+------------------+-------------------+
    8. 3 rows in set (0.02 sec)

    SHOW SHARDING TABLE RULE tableName

    Sharding Binding Table Rule

    1. mysql> show sharding binding table rules from sharding_db;
    2. +----------------------+
    3. +----------------------+
    4. | t_order,t_order_item |
    5. | t1,t2 |
    6. 2 rows in set (0.00 sec)

    Sharding Broadcast Table Rule