Help Center> Distributed Database Middleware> Best Practices> Using Global and Unsharded Tables

Using Global and Unsharded Tables

Unsharded Table

The DDM console does not allow creation of unsharded tables. Create unsharded tables after connecting to a DDM instance through a MySQL client or an application.

If a table contains fewer than 10 million entries and its data is not associated with other sharded tables for query, you are advised to set the table type to Unsharded Table and store data in the default shard.

Global Table

In business databases, some tables have a small data volume and low update frequency, but are often used for JOIN operations.

To support JOIN operations of such tables and sharded tables, DDM provides global tables, which have the following features:
  • A global table stores the same data in each shard. Data insertion, update, and deletion in global tables are executed in each shard in real time.
  • Queries of global tables are only executed in one shard.
  • All tables support JOIN with global tables.

For example,

an e-commerce company wants to query orders from Guangdong Province in the order management system. JOIN query of regional tables and order tables is required. Order tables are generally stored in different shards because they have a large data volume. To prevent cross-shard JOIN operations, users can set the regional table as a global table that stores the same data in all shards.

For details on how to configure global tables, see "Creating a Schema" in the Distributed Database Middleware User Guide. When creating a schema, set the table type to Global Table.

Do not operate global tables or perform full table scanning operations such as executing SQL statements that do not contain sharding conditions in high concurrency. Otherwise, an error message may occur, indicating that the number of backend RDS connections is insufficient. You are advised to perform such operations during off-peak hours.