All Products
Document Center

Query a logical table

Last Updated: May 19, 2022
  • In the case of database and table sharding, you may want to perform queries on a table to obtain the query result on one or more tables without the need to perform queries on all tables one by one. The most satisfying solution is querying data in these tables by using a single table.
  • To implement the preceding solution, DMS Enterprise aggregates data by using logical databases and logical tables.


  1. Select a logical table and query or export data as required.

    Try to write data to the logical table. When the routing algorithm is configured, only QUERY, UPDATE, and DELETE SQL statements are supported. The INSERT statements are not supported.

  2. Configure the routing algorithm. For more information about complex routing algorithms, see Routing algorithm configuration.

  3. After the routing algorithm is configured, run INSERT statements to write data to the logical table.

  4. After data is written to the logical table, query the data quickly by using SQL statements with query conditions.

    • After you configure the routing algorithm, you can quickly query data of routing-based fields in a specified physical table. This avoids manual calculation and switching physical tables.

    • The query result displays the database and table information in the last column. You can click the value in the column to go to the physical database or table and query data with the previous SQL statements and query conditions.

    • You can also query data in the whole logical table, including all physical tables, without using routing-based fields. For example, you can run COUNT() statements to obtain the number of records in a table. *Besides, syntaxes such as GROUP BY are supported. Other SQL syntaxes are similar to original database syntaxes, except that subqueries are not supported.