Skip to main content

Managing Database and Table Grouping

To enhance data querying, data modification, data replication, and other requirements under a database sharding architecture, NineData provides the database and table grouping feature. This article introduces how to create and delete database and table groupings.

Creating a Database Group

  1. Log in to the NineData Console.

  2. In the left navigation bar, click .

  3. Click the tab, and click Target Data Source on the page.

  4. Configure the form according to the table below, and click .

    Parameter
    Description
    Enter the name of the database group, which supports only English characters, numbers, and underscores, starting with an English character. To facilitate subsequent use and management, please try to use meaningful names.
    (Optional)Enter a business description for this database group.
    Select the name of the environment your business belongs to, and you will filter data sources based on this environment.
    Click , add data sources.
    • : Select the data sources to be added to the group, supporting multi-select, select all, and deselect operations, and also supporting searching by entering the data source name.
    • : Enter a database expression, and the system will automatically traverse and extract all databases in the target data source that match the expression based on the expression you provide. For the syntax of the expression, please refer to the Appendix of this article.
    After clicking , if you have configured , the system will automatically pull the eligible databases. If you still need to select other databases, you can manually select them in the database area on the right.
About the Standards and Processes for Database Grouping

After the database group is created, it defaults to the SQL development standards and approval processes configured in the environment it belongs to. You can change them according to your business needs.

Creating a Table Group

  1. Log in to the NineData Console.

  2. In the left navigation bar, click .

  3. Click the tab, and click the name of the target database group, or click the more in the column on the right side of the database group.

  4. On the page, click .

  5. Configure the form according to the table below, and click .

    Parameter
    Description
    Enter the name of the table group, which supports only English characters, numbers, and underscores, starting with an English character. To facilitate subsequent use and management, please try to use meaningful names.
    Supports and .
    Required when is set to . Enter an expression and click , the system will automatically traverse and extract all tables in the target database that meet the requirements based on the expression you provide. For the syntax of the expression, please refer to the Appendix of this article.
    (Optional)Configurable when is set to . Configure this parameter based on the routing algorithm configured in your application, which can quickly resolve the tables you need to access based on the routing, improving query efficiency.
    Required when is set to . Click , select the data sources to be added to the group, supporting multi-select, select all, and deselect operations, and also supporting searching by entering the data source name. After clicking , you still need to select specific databases and tables. Depending on the data source, you may also need to select specific Schemas.
    tip

    To quickly route to the table where the query conditions are located through and obtain the query results at the fastest speed, the following three conditions must be met simultaneously. If any of them are not met, the query will traverse all sharded databases and tables for the query.

    • The table group is created by an expression, not manually selected.
    • is correctly configured in the above table group creation process, and this algorithm must be consistent with the routing algorithm configured in your application.
    • The WHERE condition of the query SQL, the routing field is an equality search condition.

Removing a Table Group

When you need to readjust the database and table grouping due to changes in data structure, unreasonable grouping configuration, etc., you can remove the current table group and add it again.

  1. Log in to the NineData Console.

  2. In the left navigation bar, click .

  3. Click the tab, and click the name of the target database group, or click the more in the column on the right side of the database group.

  4. On the page, click the tab, click the more under the column on the right side of the target table group to be removed, and then click .

Deleting a Database Group

  1. Log in to the NineData Console.

  2. In the left navigation bar, click .

  3. Click the tab, and click the more under the column on the right side of the target database group to be deleted, and then click .

    tip

    If the current database group is associated with unfinished replication tasks, the database group cannot be deleted. You need to find and terminate the corresponding replication tasks and try to delete the database group again.