OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.1
    iconOceanBase Database
    SQL - V 4.3.1
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Query information about a table group

    Last Updated:2026-04-15 08:25:14  Updated
    Share
    What is on this page
    Query the SHARDING attribute of a table group
    Query table group attributes and partition information about tables in the table group through views
    Query table group attributes and databases of tables in the table group through the SHOW TABLEGROUPS statement
    Query tables in a table group
    Query the creation time of a table group
    Query the location information about tables in a table group
    References

    folded

    Share

    After you create a table group, you can query its information, including the SHARDING attribute, tables in the table group, time when the table group was created, and location information of tables in the table group.

    Query the SHARDING attribute of a table group

    Query table group attributes and partition information about tables in the table group through views

    You can query the CDB_OB_TABLEGROUPS view in the sys tenant and the DBA_OB_TABLEGROUPS view in a MySQL user tenant for the SHARDING attribute of a table group and the partition information about tables in the table group. A sample statement is as follows:

    • sys tenant

      SELECT * FROM oceanbase.CDB_OB_TABLEGROUPS WHERE tablegroup_name = 'tblgroup1';
      

      The query result is as follows:

      +-----------+-----------------+-------------------+----------------------+-----------------+------------------------+------------------------+---------------------------+----------+
      | TENANT_ID | TABLEGROUP_NAME | PARTITIONING_TYPE | SUBPARTITIONING_TYPE | PARTITION_COUNT | DEF_SUBPARTITION_COUNT | PARTITIONING_KEY_COUNT | SUBPARTITIONING_KEY_COUNT | SHARDING |
      +-----------+-----------------+-------------------+----------------------+-----------------+------------------------+------------------------+---------------------------+----------+
      |      1002 | tblgroup1       | NONE              | NONE                 |            NULL |                   NULL |                   NULL |                      NULL | ADAPTIVE |
      |      1004 | TBLGROUP1       | NONE              | NONE                 |            NULL |                   NULL |                   NULL |                      NULL | NONE     |
      +-----------+-----------------+-------------------+----------------------+-----------------+------------------------+------------------------+---------------------------+----------+
      2 rows in set
      
    • MySQL user tenant

      SELECT * FROM oceanbase.DBA_OB_TABLEGROUPS WHERE tablegroup_name = 'tblgroup1';
      

      The query result is as follows:

      +-----------------+-------------------+----------------------+-----------------+------------------------+------------------------+---------------------------+----------+
      | TABLEGROUP_NAME | PARTITIONING_TYPE | SUBPARTITIONING_TYPE | PARTITION_COUNT | DEF_SUBPARTITION_COUNT | PARTITIONING_KEY_COUNT | SUBPARTITIONING_KEY_COUNT | SHARDING |
      +-----------------+-------------------+----------------------+-----------------+------------------------+------------------------+---------------------------+----------+
      | tblgroup1       | NONE              | NONE                 |            NULL |                   NULL |                   NULL |                      NULL | ADAPTIVE |
      +-----------------+-------------------+----------------------+-----------------+------------------------+------------------------+---------------------------+----------+
      1 row in set
      

    In the query results above:

    • TENANT_ID indicates the ID of the tenant to which the table group belongs.

    • TABLEGROUP_NAME indicates the name of the table group.

    • PARTITIONING_TYPE, SUBPARTITIONING_TYPE, PARTITION_COUNT, DEF_SUBPARTITION_COUNT, PARTITIONING_KEY_COUNT, and SUBPARTITIONING_KEY_COUNT indicate the attributes of the table group with partition definitions in OceanBase Database V3.x. In OceanBase Database V4.2.1, the value of these attributes is NONE or NULL.

    • SHARDING indicates the SHARDING attribute of the table group.

      • For a table group with the SHARDING attribute set to NONE, all partitions of all tables in the table group are aggregated on the same server, and no limitations are imposed on tables to be added to the table group.

      • For a table group with the SHARDING attribute set to PARTITION, the data of each table in the table group is scattered by partition. For a subpartitioned table in the table group, all subpartitions in each partition are aggregated together.

        A table to be added to the table group must have the same partition definition as existing tables in the table group, including the partitioning type, partition count, and partition value.

      • For a table group with the SHARDING attribute set to ADAPTIVE, the data of each table in the table group is adaptively scattered. In other words, data in partitioned tables is scattered by partition, and data in subpartitioned tables is scattered by subpartition in each partition.

        A table to be added to the table group must have the same partition definition and subpartition definition as existing tables in the table group, including the partitioning type, partition count, and partition value.

    Query table group attributes and databases of tables in the table group through the SHOW TABLEGROUPS statement

    You can also execute the SHOW TABLEGROUPS statement in the sys tenant or a MySQL user tenant to view the SHARDING attribute of a table group and the databases to which tables in the table group belong. A sample statement is as follows:

    SHOW TABLEGROUPS WHERE tablegroup_name = 'tblgroup1';
    

    The query result is as follows:

    +-----------------+------------+---------------+----------+
    | Tablegroup_name | Table_name | Database_name | Sharding |
    +-----------------+------------+---------------+----------+
    | tblgroup1       | tbl3       | test          | ADAPTIVE |
    +-----------------+------------+---------------+----------+
    1 row in set
    

    In the query result above:

    • Tablegroup_name indicates the name of the table group.

    • Table_name indicates the name of the table.

    • Database_name indicates the name of the database to which the table belongs.

    • Sharding indicates the SHARDING attribute of the table group.

      • For a table group with the SHARDING attribute set to NONE, all partitions of all tables in the table group are aggregated on the same server, and no limitations are imposed on tables to be added to the table group.

      • For a table group with the SHARDING attribute set to PARTITION, the data of each table in the table group is scattered by partition. For a subpartitioned table in the table group, all subpartitions in each partition are aggregated together.

        A table to be added to the table group must have the same partition definition as existing tables in the table group, including the partitioning type, partition count, and partition value.

      • For a table group with the SHARDING attribute set to ADAPTIVE, the data of each table in the table group is adaptively scattered. In other words, data in partitioned tables is scattered by partition, and data in subpartitioned tables is scattered by subpartition in each partition.

        A table to be added to the table group must have the same partition definition and subpartition definition as existing tables in the table group, including the partitioning type, partition count, and partition value.

    Query tables in a table group

    You can query the CDB_OB_TABLEGROUP_TABLES view in the sys tenant or the DBA_OB_TABLEGROUP_TABLES view in a MySQL user tenant for the tables in a table group and the databases to which the tables belong. A sample statement is as follows:

    • sys tenant

      SELECT * FROM oceanbase.CDB_OB_TABLEGROUP_TABLES WHERE tablegroup_name = 'tblgroup1';
      

      The query result is as follows:

      +-----------+-----------------+-------+------------+----------+
      | TENANT_ID | TABLEGROUP_NAME | OWNER | TABLE_NAME | SHARDING |
      +-----------+-----------------+-------+------------+----------+
      |      1002 | tblgroup1       | test  | tbl3       | ADAPTIVE |
      |      1004 | TBLGROUP1       | SYS   | TBL3       | NONE     |
      +-----------+-----------------+-------+------------+----------+
      2 rows in set
      
    • MySQL user tenant

      SELECT * FROM oceanbase.DBA_OB_TABLEGROUP_TABLES WHERE tablegroup_name = 'tblgroup1';
      

      The query result is as follows:

      +-----------------+-----------+------------+----------+
      | TABLEGROUP_NAME | OWNER     | TABLE_NAME | SHARDING |
      +-----------------+-----------+------------+----------+
      | tblgroup1       | test      | tbl3       | ADAPTIVE |
      +-----------------+-----------+------------+----------+
      1 row in set
      

    In the query results above:

    • TENANT_ID indicates the ID of the tenant to which the table group belongs.

    • TABLEGROUP_NAME indicates the name of the table group.

    • OWNER indicates the database to which the table belongs.

    • TABLE_NAME indicates the name of the table.

    • SHARDING indicates the SHARDING attribute of the table group.

      • For a table group with the SHARDING attribute set to NONE, all partitions of all tables in the table group are aggregated on the same server, and no limitations are imposed on tables to be added to the table group.

      • For a table group with the SHARDING attribute set to PARTITION, the data of each table in the table group is scattered by partition. For a subpartitioned table in the table group, all subpartitions in each partition are aggregated together.

        A table to be added to the table group must have the same partition definition as existing tables in the table group, including the partitioning type, partition count, and partition value.

      • For a table group with the SHARDING attribute set to ADAPTIVE, the data of each table in the table group is adaptively scattered. In other words, data in partitioned tables is scattered by partition, and data in subpartitioned tables is scattered by subpartition in each partition.

        A table to be added to the table group must have the same partition definition and subpartition definition as existing tables in the table group, including the partitioning type, partition count, and partition value.

    Query the creation time of a table group

    You can query the CDB_OBJECTS view in the sys tenant or the DBA_OBJECTS view in a MySQL user tenant for information such as the creation time and last DDL operation of a table group. A sample statement is as follows:

    • sys tenant

      SELECT OBJECT_NAME,CREATED, LAST_DDL_TIME FROM oceanbase.CDB_OBJECTS WHERE object_name = 'tblgroup1';
      

      A sample query result is as follows:

      +-------------+---------------------+---------------------+
      | OBJECT_NAME | CREATED             | LAST_DDL_TIME       |
      +-------------+---------------------+---------------------+
      | tblgroup1   | 2023-06-27 14:58:53 | 2023-06-27 15:15:54 |
      | TBLGROUP1   | 2023-06-27 15:25:30 | 2023-06-27 15:25:30 |
      +-------------+---------------------+---------------------+
      2 rows in set
      
    • MySQL user tenant

      SELECT OBJECT_NAME,CREATED, LAST_DDL_TIME FROM oceanbase.DBA_OBJECTS WHERE object_name = 'tblgroup1';
      

      A sample query result is as follows:

      +-------------+---------------------+---------------------+
      | OBJECT_NAME | CREATED             | LAST_DDL_TIME       |
      +-------------+---------------------+---------------------+
      | tblgroup1   | 2023-06-27 14:58:53 | 2023-06-27 15:15:54 |
      +-------------+---------------------+---------------------+
      1 row in set
      

    In the query results above:

    • OBJECT_NAME indicates the object name, which is the name of the queried table group.
    • CREATED indicates the time when the table group was created.
    • LAST_DDL_TIME indicates the time when the last DDL operation was performed.

    Query the location information about tables in a table group

    You can query the DBA_OB_TABLE_LOCATIONS view in the sys tenant or a MySQL user tenant for the location information about tables in a table group, including the tablet ID of each partition, mappings between tablet IDs and log stream IDs, and location information of log stream replicas. A sample statement is as follows:

    SELECT * FROM oceanbase.DBA_OB_TABLE_LOCATIONS WHERE tablegroup_name = 'tblgroup1';
    

    The query result is as follows:

    +---------------+------------+----------+------------+----------------+-------------------+------------+---------------+-----------+-------+-------+----------------+----------+----------+--------------+-----------------+-----------+-----------------+---------------+----------+
    | DATABASE_NAME | TABLE_NAME | TABLE_ID | TABLE_TYPE | PARTITION_NAME | SUBPARTITION_NAME | INDEX_NAME | DATA_TABLE_ID | TABLET_ID | LS_ID | ZONE  | SVR_IP         | SVR_PORT | ROLE     | REPLICA_TYPE | DUPLICATE_SCOPE | OBJECT_ID | TABLEGROUP_NAME | TABLEGROUP_ID | SHARDING |
    +---------------+------------+----------+------------+----------------+-------------------+------------+---------------+-----------+-------+-------+----------------+----------+----------+--------------+-----------------+-----------+-----------------+---------------+----------+
    | test          | tbl3       |   500089 | USER TABLE | p0             | mp0               | NULL       |          NULL |    200055 |  1001 | zone1 | xx.xx.xx.197   |     2882 | LEADER   | FULL         | NONE            |    500092 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p0             | mp0               | NULL       |          NULL |    200055 |  1001 | zone2 | xx.xx.xx.194   |     2882 | FOLLOWER | FULL         | NONE            |    500092 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p0             | mp1               | NULL       |          NULL |    200056 |  1001 | zone1 | xx.xx.xx.197   |     2882 | LEADER   | FULL         | NONE            |    500093 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p0             | mp1               | NULL       |          NULL |    200056 |  1001 | zone2 | xx.xx.xx.194   |     2882 | FOLLOWER | FULL         | NONE            |    500093 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p0             | mp2               | NULL       |          NULL |    200057 |  1001 | zone1 | xx.xx.xx.197   |     2882 | LEADER   | FULL         | NONE            |    500094 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p0             | mp2               | NULL       |          NULL |    200057 |  1001 | zone2 | xx.xx.xx.194   |     2882 | FOLLOWER | FULL         | NONE            |    500094 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p1             | mp3               | NULL       |          NULL |    200058 |  1001 | zone1 | xx.xx.xx.197   |     2882 | LEADER   | FULL         | NONE            |    500095 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p1             | mp3               | NULL       |          NULL |    200058 |  1001 | zone2 | xx.xx.xx.194   |     2882 | FOLLOWER | FULL         | NONE            |    500095 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p1             | mp4               | NULL       |          NULL |    200059 |  1001 | zone1 | xx.xx.xx.197   |     2882 | LEADER   | FULL         | NONE            |    500096 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p1             | mp4               | NULL       |          NULL |    200059 |  1001 | zone2 | xx.xx.xx.194   |     2882 | FOLLOWER | FULL         | NONE            |    500096 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p1             | mp5               | NULL       |          NULL |    200060 |  1001 | zone1 | xx.xx.xx.197   |     2882 | LEADER   | FULL         | NONE            |    500097 | tblgroup1       |        500083 | ADAPTIVE |
    | test          | tbl3       |   500089 | USER TABLE | p1             | mp5               | NULL       |          NULL |    200060 |  1001 | zone2 | xx.xx.xx.194   |     2882 | FOLLOWER | FULL         | NONE            |    500097 | tblgroup1       |        500083 | ADAPTIVE |
    +---------------+------------+----------+------------+----------------+-------------------+------------+---------------+-----------+-------+-------+----------------+----------+----------+--------------+-----------------+-----------+-----------------+---------------+----------+
    12 rows in set
    

    In the query result above:

    • DATABASE_NAME indicates the name of the database to which the table belongs.

    • TABLE_NAME indicates the name of the table.

    • TABLE_ID indicates the ID of the table.

    • TABLE_TYPE indicates the type of the table. Valid values include:

      • USER TABLE: a user table.
      • SYSTEM TABLE: a system table, which is an index table created by the system.
      • LOB AUX TABLE: a LOB auxiliary table, which is created by the system to implement LOB columns.
    • PARTITION_NAME indicates the name of the partition. For a non-partitioned table, the value is NULL by default.

    • SUBPARTITION_NAME indicates the name of the subpartition. The value NULL indicates that no subpartition exists.

    • INDEX_NAME indicates the name of the index table. If the table is not an index table, the value is NULL.

    • DATA_TABLE_ID indicates the ID of the primary table. If the table is not an index table or LOB table, the value is NULL.

    • TABLET_ID indicates the tablet ID of the partition.

    • LS_ID indicates the ID of the log stream to which the table belongs.

    • ZONE indicates the zone where the replica is located.

    • SVR_IP indicates the IP address of the OBServer node where the replica is located.

    • SVR_PORT indicates the port of the OBServer node where the replica is located.

    • ROLE indicates the role of the log stream replica.

    • REPLICA_TYPE indicates the type of the log stream replica. Valid values are the following ones:

      • FULL: a full-featured replica.
      • READONLY: a read-only replica.
    • OBJECT_ID indicates the object ID. If the table is a non-partitioned table, the value is the ID of the table. If the table is a partitioned table, this field shows the ID of each partition in the table.

    • TABLEGROUP_NAME indicates the name of the queried table group.

    • TABLEGROUP_ID indicates the ID of the queried table group.

    • SHARDING indicates the SHARDING attribute of the table group.

      • For a table group with the SHARDING attribute set to NONE, all partitions of all tables in the table group are aggregated on the same server, and no limitations are imposed on tables to be added to the table group.

      • For a table group with the SHARDING attribute set to PARTITION, the data of each table in the table group is scattered by partition. For a subpartitioned table in the table group, all subpartitions in each partition are aggregated together.

        A table to be added to the table group must have the same partition definition as existing tables in the table group, including the partitioning type, partition count, and partition value.

      • For a table group with the SHARDING attribute set to ADAPTIVE, the data of each table in the table group is adaptively scattered. In other words, data in partitioned tables is scattered by partition, and data in subpartitioned tables is scattered by subpartition in each partition.

        A table to be added to the table group must have the same partition definition and subpartition definition as existing tables in the table group, including the partitioning type, partition count, and partition value.

    References

    • Table groups

    • Create a table group

    • Add tables to a table group

    • Modify the SHARDING attribute of a table group

    • Manage tables in a table group

    • Drop a table group

    Previous topic

    Create a table group
    Last

    Next topic

    Add tables to a table group
    Next
    What is on this page
    Query the SHARDING attribute of a table group
    Query table group attributes and partition information about tables in the table group through views
    Query table group attributes and databases of tables in the table group through the SHOW TABLEGROUPS statement
    Query tables in a table group
    Query the creation time of a table group
    Query the location information about tables in a table group
    References