Table Reference #
Syntax | Description | Type |
---|---|---|
CREATE SHARDING TABLE REFERENCE RULE tableReferenceRuleDefinition [, tableReferenceRuleDefinition] … | Create sharding table reference | RDL |
ALTER SHARDING TABLE REFERENCE RULE tableReferenceRuleDefinition [, tableReferenceRuleDefinition] … | Modify sharding table reference | RDL |
ALTER SHARDING BINDING TABLE RULE TO | Only used by SphereEx-Console, not specified in the document | RDL |
DROP SHARDING TABLE REFERENCE RULE tableReferenceRuleDefinition [, tableReferenceRuleDefinition] … | Delete table reference | RDL |
SHOW SHARDING TABLE REFERENCE RULES [FROM databaseName] | View table reference | RQL |
SHOW SHARDING TABLE REFERENCE RULE ruleName | Implement in version 1.3.0 | RQL |
1. Create Sharding Table Reference #
CREATE SHARDING TABLE REFERENCE RULE tableReferenceRuleDefinition [, tableReferenceRuleDefinition] ...
tableReferenceRuleDefinition:
(tableName [, tableName] ... )
Example
CREATE SHARDING TABLE REFERENCE RULE (t_order,t_order_item),(t_1,t_2);
2. Modify Sharding Table Reference #
ALTER SHARDING TABLE REFERENCE RULE tableReferenceRuleDefinition [, tableReferenceRuleDefinition] ...
tableReferenceRuleDefinition:
(tableName [, tableName] ... )
Example
ALTER SHARDING TABLE REFERENCE RULE (t_order,t_order_item);
3. Delete Sharding Table Reference #
DROP SHARDING TABLE REFERENCE RULE tableReferenceRuleDefinition [, tableReferenceRuleDefinition] ...
tableReferenceRuleDefinition:
(tableName [, tableName] ... )
Example
Delete all table reference
DROP SHARDING TABLE REFERENCE RULE;
Delete specified table reference
DROP SHARDING TABLE REFERENCE RULE (t_order,t_order_item);
4. View Table Reference #
SHOW SHARDING TABLE REFERENCE RULES;
Parameter Description
None
Example
mysql> SHOW SHARDING TABLE REFERENCE RULES;
+--------------------------+
| sharding_table_reference |
+--------------------------+
| t_order,t_order_item |
| t1,t2 |
+--------------------------+
2 rows in set (0.00 sec)
Output Description
Column | Description |
---|---|
sharding_table_reference | Table reference |