All Products
Search
Document Center

Logical database and table

Last Updated: May 28, 2020
  • Database sharding and table partitioning technology is used in various databases, such as RDS databases or databases built by users on ECS or on-premises IDCs. For example, a database instance is divided into 8 databases, each of which has 32 tables. It is complicated to perform data queries and schema changes on each database and table, and consistency cannot be guaranteed among them. Therefore, for ease of management, we need to configure these tables as a single table to operate.

    • To meet this need, DMS Enterprise proposes the concepts of logical databases and logical tables. We will use a series of topics to describe how to configure a logical database, a logical table, and a routing algorithm from scratch, and how to query a logical table and change its schema after it is configured.
  • This topic describes how to configure four physical databases as a logical database.

Procedure

  1. Search for the target physical databases. We recommend that you search for the first physical database by name or enter the prefix for a fuzzy match.

  2. Choose More > Configure Logical Database.

    • In the configuration dialog box that appears, the currently selected physical database appears in the list of selected physical databases on the right by default. The physical database name with the numbering and its leading underscore (_) removed is used as the search condition to automatically load the list of physical databases to be selected on the left. If the left list is not as expected, you can manually enter the prefix of the physical database name for a fuzzy match. If multiple physical databases have the same name, you can enter database name%instance address to filter out the target physical databases.1
  3. Select the target physical databases from the left list and add them to the list of selected physical databases on the right. Then save the configuration.

    • You must add the selected physical databases to the list on the right in their original order. If you add them out of order, you will fail to query physical tables in the logical database later.
    • By default, the name of the configured logical database is the physical database name with the numbering and its leading underscore (_) removed. You can specify an alias for the logical database to distinguish it from others.
    • The physical databases must be owned by the same data owner. Otherwise, they cannot be configured as a logical database. Only the administrator and DBA have the permission to change the data owner of each physical database to be the same. If the physical databases are owned by the same owner, the owner can configure them as a logical database.
  4. Confirm the configuration.

    • A new logical database record is generated after the configuration is complete. You can click Logical Database corresponding to the record to view the physical database distribution in the dialog box that appears.

Use

  • After the logical database is configured, you can use it as follows:
    • If the logical database is new, you can submit a schema design ticket to create a logical table and modify the logical table later.
    • If the logical database already exists and is in use, physical tables in the logical database are automatically aggregated to a logical table after the configuration. You can conveniently perform data queries and changes on this single logical table instead of physical tables.

The next topic describes how to submit a schema design ticket to create a logical table.