This paper introduces the operation of managing data tables on PolarDB-X 1.0 console.

Prerequisites

You must connect to a database and use SQL statements to create tables before you manage tables in the console. For more information, see Connect to database and Basic SQL operations.

Function introduction

Adjust shard keys

In a PolarDB-X 1.0 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 PolarDB-X 1.0 are the same, only when they use the same sharding function and shard key. The same sharding method enables PolarDB-X 1.0 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, PolarDB-X 1.0 scans all database shards or all table shards when it processes the SQL query.

Disable full table scan

By default, PolarDB-X 1.0 enables the full table scan feature for newly created tables. However, frequent use of the full table scan feature consumes database resources and reduces query efficiency. PolarDB-X 1.0 supports manually disable full table scan in the console.

Query table schema

You can manage tables in the PolarDB-X 1.0 console and view table schema details.

Delete tables

Tables cannot be directly deleted in the PolarDB-X 1.0 console. You can log on to a database and use SQL statements to delete tables. For more information, see Connect to database and Basic SQL operations.

Enter the data tables interface

  1. Log on to the PolarDB-X 1.0 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.

Adjust shard keys

  1. On the tables page, find the target table and click Adjust Shard Key in the Actions column.
  2. 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.
  3. In the dialog box that appears, click Adjust after the precheck results are displayed.
    Adjustment

Disable full table scan

Note
  • The target table must have a specified shard key. For more information about how to set a shard key, see Adjust shard keys.
  • If the full table scan feature is not enabled for a PolarDB-X 1.0 table shard, you must include the shard key in the WHERE clause to access the table. Otherwise, PolarDB-X 1.0 will return the TDDL-4510 error code.
  1. On the tables page, find the target table and click Advanced Settings in the Actions column.
    Full table scan
    Note The full table scan feature is supported only when Table Attribute is set to Database Shard. You can click Adjust shard keys to start database sharding.
  2. In the dialog box that appears, select No and click OK.
    Enable full table scan

Query table schema

On the tables page, find the target table and click View Table Schema in the Actions column. In the dialog box that appears, you can view table schema details, such as the column name, data type, and whether a column is a primary key.

Query table schema