All Products
Search
Document Center

Logical database

Last Updated: Dec 11, 2019

Definition

  • When the business reaches a certain scale, load balancing needs to be conducted through database sharding and table partitioning to smoothly support business expansion.
  • Number of physical databases >= 1
    • If the number of physical databases is greater than 1, the number of database names and their suffix format must meet the following requirements:
      • Generally, the number of databases is an exponential power of 2.
      • Generally, the suffix of a database name is in the format of _xxxx. In the format, xxxx is a four-digit number, which starts from 0000 and increments by 1.
    • If the number of physical databases is equal to 1, only a single database with table partitioning is configured as a logical database.
  • Typical scenarios:
    • Single database with table partitioning
    • Database sharding with table partitioning (most common)
    • Database sharding without table partitioning (same name of a table on different database shards)

Usage

  1. You can select either a physical database or logical database to query data in the SQLConsole, design the table schema, and export or change data.
    • If you select a logical database, you can conveniently use a logical table to perform data operations on multiple table shards in a unified way. That is, you can treat multiple table shards as a single table to write SQL statements.
  2. Apply for the permissions on data sources. If you directly apply for the permissions on a logical database, you have the permissions on all the physical databases associated with the logical database.

Configuration

  • Create a logical database
    • Find the target physical database from the database list and choose More > Configure Logical Database. In the dialog box that appears, create a logical database as the data owner or DBA.