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.4.2

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive 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.4.2
    iconOceanBase Database
    SQL - V 4.4.2
    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

    Manage tables in a table group

    Last Updated:2026-04-02 06:23:57  Updated
    Share
    What is on this page
    Manage partitions of a table
    Considerations for modifying table partitions
    Rules for modifying partitions of a table
    Modify partitions of a table
    Remove a table from a table group
    Move a table to another table group
    References

    folded

    Share

    After you add a table to a table group, you can manage partitions of the table, remove the table from the table group, or move the table to another table group. For example, you can change the partitioning type, number of partitions, or partition value of the table, add a partition to the table, or drop a partition from the table.

    Manage partitions of a table

    Considerations for modifying table partitions

    After you modify table partitions, data distribution may change, which may lead to unbalanced resource allocation. Therefore, we recommend that you enable partition balancing for the tenant when modifying table partitions to ensure optimal and balanced resource allocation.

    For more information about data load balancing, see Load balancing overview.

    Notice

    • When upgrading from OceanBase Database V4.4.0 or earlier to V4.4.1:
      • The scheduled partition balancing task SCHEDULED_TRIGGER_PARTITION_BALANCE is disabled by default (enabled = 0).
      • The value of the tenant-level parameter partition_balance_schedule_interval remains unchanged. Partition balancing tasks still depend on the tenant-level parameter partition_balance_scheduler_interval, maintaining the behavior before V4.4.1.
      • When you enable the scheduled task SCHEDULED_TRIGGER_PARTITION_BALANCE, the system validates that partition_balance_schedule_interval = 0; otherwise, error OB_OP_NOT_ALLOW is returned.
    • For tenants created in OceanBase Database V4.4.1:
      • The scheduled partition balancing task SCHEDULED_TRIGGER_PARTITION_BALANCE is enabled by default (enabled = 1).
      • The tenant-level parameter partition_balance_schedule_interval defaults to 0. Partition balancing is triggered entirely by the scheduled task and manual triggers. For more information, see Configure a scheduled partition balancing task and Manually trigger partition balancing.
      • When you set partition_balance_schedule_interval, the system validates that SCHEDULED_TRIGGER_PARTITION_BALANCE is disabled; otherwise, error OB_OP_NOT_ALLOW is returned.

    Rules for modifying partitions of a table

    Before you perform partition management operations on a table in a table group, you can query views for the SHARDING attribute of the table group, tables in the table group, and partition information about tables in the table group. For more information, see Query information about a table group.

    If the table group contains only the current table, you can perform partition management operations without limitations. If the table group contains other tables, follow the following rules:

    • When the SHARDING attribute of the table is set to NONE:

      • If the table is a non-partitioned table, you can change it to a partitioned or subpartitioned table.

      • If the table is a partitioned table, you can change it to a subpartitioned table. If the table is a subpartitioned table, you can change it to a partitioned or non-partitioned table. You can also add or drop partitions. In other words, you can change the partitioning type, partition count, and partition value without limitations.

    • When the SHARDING attribute of the table group is set to PARTITION:

      • If the table is a non-partitioned table, you cannot change it to a partitioned table.

      • If the table is a partitioned table, you cannot change it to a non-partitioned table.

        • If the table is a partitioned table, you can change it to a subpartitioned table that has the same partitioning type, partition count, and partition value as other tables in the table group. No limitations are imposed on the subpartitioning type, subpartition count, or subpartition value. You can change the number of partitions in the table only by adding or dropping partitions. You are not allowed to take other means to change the partitioning type, partition count, or partition value to a value different from that of other tables in the table group.

        • If the table is a subpartitioned table, you can change it to a partitioned table that has the same partitioning type, partition count, and partition value as other tables in the table group. You can change the number of partitions in the table only by adding or dropping partitions. You are not allowed to take other means to change the partitioning type, partition count, or partition value to a value different from that of other tables in the table group.

        The system does not implement load balancing on a table group for which a partition addition or drop operation has been performed. The system implements load balancing only after the partitioning type, partition count, and partition value of all tables in the table group meet the requirements of the PARTITION attribute value.

    • When the SHARDING attribute of the table group is set to ADAPTIVE:

      • If the table is a non-partitioned table, you cannot change it to a partitioned table.

      • If the table is a partitioned table, you cannot change it to a non-partitioned table.

        • If the table group contains only partitioned tables, you cannot change this table to a non-partitioned or subpartitioned table. You can change the number of partitions in the table only by adding or dropping partitions. You are not allowed to take other means to change the partitioning type, partition count, or partition value to a value different from that of other tables in the table group.

        • If the table group contains only subpartitioned tables, you cannot change this table to a partitioned table. You can change the number of partitions in the table only by adding or dropping partitions or subpartitions. You are not allowed to take other means to change the partitioning type, partition count, or partition value to a value different from that of other tables in the table group.

        The system does not implement load balancing on a table group for which a partition/subpartition addition or drop operation has been performed. The system implements load balancing only after the partitioning type, partition count, and partition value of all tables in the table group meet the requirements of the ADAPTIVE attribute value.

    Modify partitions of a table

    You can refer to the following topics to modify partitions of a table based on the actual situation and modification rules:

    • Modify partitioning rules

    • Add a partition

    • Drop a partition

    • Set partition weight

    • Clear partition weight

    Remove a table from a table group

    After a table is added to a table group, you can execute the following statement to remove it from the table group:

    ALTER TABLE table_name SET TABLEGROUP '';
    

    Here is an example:

    1. Assume that the table group tblgroup1 contains the tbl1 and tbl2 tables. Execute the following statement to view the tables in the table group:

      SHOW TABLEGROUPS WHERE tablegroup_name = 'tblgroup1';
      

      A sample query result is as follows:

      +-----------------+------------+---------------+----------+
      | Tablegroup_name | Table_name | Database_name | Sharding |
      +-----------------+------------+---------------+----------+
      | tblgroup1       | tbl1       | test          | ADAPTIVE |
      | tblgroup1       | tbl2       | test          | ADAPTIVE |
      +-----------------+------------+---------------+----------+
      2 rows in set
      
    2. Remove the tbl1 table from the table group.

      ALTER TABLE tbl1 SET TABLEGROUP '';
      
    3. View the tables in the table group.

      SHOW TABLEGROUPS WHERE tablegroup_name = 'tblgroup1';
      

      A sample query result is as follows:

      +-----------------+------------+---------------+----------+
      | Tablegroup_name | Table_name | Database_name | Sharding |
      +-----------------+------------+---------------+----------+
      | tblgroup1       | tbl2       | test          | ADAPTIVE |
      +-----------------+------------+---------------+----------+
      1 rows in set
      

    Move a table to another table group

    After a table is added to a table group, you can move the table to another table group.

    Before you move a table to another table group, check the SHARDING attribute of the target table group and the partition information of existing tables in the table group to verify whether the current table meets the conditions for joining the table group. For more information about how to view the information about a table group, see Query information about a table group.

    • If the SHARDING attribute is set to NONE, the table group has no limitations on tables. In this case, you can directly move the table to this table group.

    • If the SHARDING attribute is set to PARTITION, the table to be moved must have the same partition definition as existing tables in the table group, including the partitioning type, partition count, and partition value. Such a table group can contain both partitioned tables and subpartitioned tables.

      Specifically, the same partition definition means that:

      • Tables in the table group have the same partitioning type, such as RANGE partitioning.
      • HASH-partitioned tables have the same number of referenced columns and the same number of partitions.
      • RANGE-partitioned tables have the same number of referenced columns, the same number of partitions, and the same range definition.
    • If the SHARDING attribute is set to ADAPTIVE, the table to be moved 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. The tables in the table group must be all partitioned tables or all subpartitioned tables.

      Specifically, the same partition definition means that:

      • Tables in the table group have the same partitioning type such as HASH-RANGE partitioning.
      • HASH-partitioned tables have the same number of referenced columns and the same number of partitions.
      • RANGE-partitioned tables have the same number of referenced columns, the same number of partitions, and the same range definition.
      • The requirements on subpartitions are the same as those on partitions, depending on the partitioning type.

    The SQL syntax for moving a table to another table group is as follows:

    ALTER TABLE table_name SET TABLEGROUP tablegroup_name;
    

    For example, move the tbl1 table to the table group tblgroup2.

    ALTER TABLE tbl1 SET TABLEGROUP tblgroup2;
    

    References

    • About table groups

    • Create a table group

    • View table group information

    • Add tables to a table group

    • Modify the SHARDING attribute of a table group

    • Drop a table group

    Previous topic

    Modify the SHARDING attribute of a table group
    Last

    Next topic

    Drop a table group
    Next
    What is on this page
    Manage partitions of a table
    Considerations for modifying table partitions
    Rules for modifying partitions of a table
    Modify partitions of a table
    Remove a table from a table group
    Move a table to another table group
    References