A logical database maps one or more physical databases to a single entity, so sharded data appears as one database to your queries and operations.
When your business data and traffic grow beyond what a single database can handle, you split data across multiple physical databases — a technique called sharding. A logical database sits on top of those physical shards and presents them as one unified database, letting you query and manage all shards without writing shard-aware SQL.
With a logical database, you can:
Query logical tables or table partitions as if they were a single table.
Design schemas across all shards in one place.
Export or change data without targeting each physical database separately.
Apply for permissions on the logical database to get access to all associated physical databases at once.
Supported configurations
A logical database works in three configurations:
| Configuration | Description |
|---|---|
| Single database with table partitions | One physical database with horizontal partitioning. |
| Sharded database with table partitions | Multiple physical databases, each with partitioned tables. |
| Sharded database without table partitions | Multiple physical databases, tables are not partitioned. |
Naming requirements
The naming rules for physical databases depend on how many databases make up the logical database.
Single physical database
If the logical database maps to exactly one physical database, that database must use table partitions.
Multiple physical databases
If the logical database maps to more than one physical database, the count and names of those databases must follow these rules:
| Requirement | Details |
|---|---|
| Count | The number of databases is typically a power of 2 (2, 4, 8, 16, ...). |
| Name suffix | Each database name ends with _xxxx, where xxxx is a four-digit zero-padded number starting from 0000 and incrementing by 1 for each database. |
Configure a logical database
A data owner or database administrator (DBA) can configure logical databases.
In the top navigation bar of the Data Management console, click the
icon to search for the database.In the database list, find the target database.
In the Actions column, move the pointer over More, then click Configure Logical Database.