You can manage tables in the DRDS console and adjust shard keys of tables.

Prerequisites

You must create tables before you manage tables in the console. For more information, see Create a DRDS table.

Background information

In a DRDS instance, the sharding method of a logical table is defined jointly by a sharding function and a shard key. The sharding function contains the number of shards to be created and the routing algorithm. The shard key also specifies the MySQL data type of the shard key. You can consider that the database sharding and table sharding methods of a logical table in DRDS are the same, only when they use the same sharding function and shard key. The same sharding method enables DRDS to locate a unique physical database shard and physical table shard based on the value of the shard key. If the database sharding and table sharding methods of a logical table are different and an SQL query does not contain both the database shard key and the table shard key, DRDS scans all database shards or all table shards when it processes the SQL query. For more information, see Disable full table scan.

Procedure

  1. Log on to the DRDS console.
  2. In the top navigation bar, select the region where the target instance is located.
  3. In the left-side navigation pane, click Instances.
  4. On the page that appears, find the target instance and click the instance ID.
  5. In the left-side navigation pane, choose Configuration and Management > Databases.
  6. On the page that appears, find the target database and click the database name.
    Click the database name
  7. In the left-side navigation pane, choose Table Management > Tables.
  8. On the page that appears, find the target table and click Adjust Shard Key in the Actions column.
  9. In the dialog box that appears, adjust the shard key settings as needed, and click Precheck.
    Adjust shard keys
    Note
    • Do not modify the generated temporary or destination table before the precheck task is completed.
    • Do not adjust the shard key for tables that have global secondary indexes. For more information about shard key selection and table shard forms, see CREATE TABLE and Overview.
  10. In the dialog box that appears, click Adjust after the precheck results are displayed.
    Adjustment