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

    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.3
    iconOceanBase Database
    SQL - V 4.3.3
    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

    Reference partitioned tables and indexes

    Last Updated:2024-12-02 03:48:26  Updated
    share
    What is on this page
    Syntax
    Limitations on extension names
    Examples

    folded

    share

    Tables and indexes can be split into multiple partitions and each partition has the same logical attributes. For example, all partitions in a table share the same column and constraint definitions, whereas all partitions in an index share the same index column.

    You can use partition extensions and subpartition extensions to perform some partition-level and subpartition-level operations. For example, you can delete all rows in a single partition or subpartition. Without an extension name, you must use a judgment statement (WHERE clause) to define the deletion scope. Judgment statements are not suitable for defining the partition-level operation scope in range partitioned tables and list partitioned tables, especially when the range partition key has multiple columns. Hash partitions and subpartitions are based on the hash function defined by the system. Therefore, judgment statements do not work well for them.

    Partition extensions allow you to use partitions in the same way as you use a table. One advantage of this approach (most useful for range partitioned tables) is that you can establish an access control mechanism at the partition level by granting (or revoking) privileges on these views to other users or roles. To use a partition as a table, you need to create a view by selecting data from a single partition, and then use the view as a table.

    Syntax

    You can use the following SQL syntax to specify partition extensions and subpartition extensions.

    The syntax for specifying a partition extension is as follows:

    PARTITION partition
    

    The syntax for specifying a subpartition extension is as follows:

    SUBPARTITION subpartition
    

    In DML statements INSERT, UPDATE, DELETE and ANALYZE, enclose the partition or subpartition extension in parentheses.

    Limitations on extension names

    When you use partition extensions and subpartition extensions, note the following limitations:

    • No synonyms are allowed in the name. Use the underlying table to specify a partition or subpartition extension name. Synonyms, views, or any other objects are not allowed.

    • In the PARTITION and SUBPARTITION clauses, do not specify binding variables for a partition or subpartition name.

    Examples

    In the following example, the partitioned table sales has the sales_q1_2021 partition. Create a view for the partition, and then delete some rows from the partition.

    /*Create the Q1_2021_sales view for the sales_q1_2000 partition.*/
    CREATE VIEW Q1_2021_sales
    AS
    SELECT *
    FROM sales PARTITION (SALES_Q1_2021);
    
    /*Delete all values that meet the condition of amount_sold < 0 from the Q1_2021_sales view.*/
    DELETE FROM Q1_2021_sales
    WHERE amount_sold < 0;
    

    Previous topic

    Reference a DBLink
    Last

    Next topic

    Reference an attribute or method of an object type
    Next
    What is on this page
    Syntax
    Limitations on extension names
    Examples