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

    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.1.0
    iconOceanBase Database
    SQL - V 4.1.0
    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

    TableAPI data models

    Last Updated:2023-07-28 02:55:43  Updated
    Share
    What is on this page
    Table model
    Secondary index
    Security authentication
    Comparison with the SQL mode
    Advantages
    Disadvantages
    KV model

    folded

    Share

    Table model

    Data in a table, such as an SQL table, is highly constrained by the schema.

    You can execute a DDL statement to create a table. All types of partitioned tables of OceanBase Database are supported. The table must contain a primary key and several strongly-typed columns. You can also define secondary indexes and a UNIQUE constraint for the table.

    OceanBase TableAPI provides table model-based API operations that can be seamlessly integrated or used with SQL statements in OceanBase Database. In addition to the query operations, table model-based API operations support data reads and writes by using the primary key.

    Secondary index

    You can create indexes for a table. Table indexes will be updated in all TableAPI operations.

    The Query operation enables you to query and scan data based on secondary indexes. However, the regular KV model allows you to query data only by the primary key, which is not enough in many business circumstances. As a result, you must maintain an index table at the business layer if your applications use a database of the simple KV model that supports only primary key-based queries. This complicates the processing of business data and makes it difficult to ensure data consistency between the indexes and the primary table. In addition, reading and writing the index table require multiple interactions between the application and database, which results in high latency.

    OceanBase TableAPI solves the preceding problems by providing native support for secondary indexes on the server.

    Security authentication

    TableAPI operations are authenticated in the same way as that in SQL mode. TableAPI allows you to execute SQL statements to manage tenants, users, and passwords.

    Comparison with the SQL mode

    OceanBase TableAPI provides table model-based API operations that can be seamlessly integrated or used with SQL statements in OceanBase Database. This section describes the advantages and disadvantages of TableAPI in comparison with the SQL mode.

    Advantages

    • Designed on the distributed storage layer, TableAPI features a short data access path and shows better performance for the same function. Because of its simple semantics, TableAPI is easier to optimize and is more predictable.
    • The semantics of batch operations are more flexible and efficient than those in SQL mode. For example, you can call a multi-get operation to select columns of different rows.
    • TableAPI is easy to use and provides entity semantics without complex ER mapping.
    • Unlike the JDBC or ODBC API, TableAPI works on a simple RPC protocol and does not have any reconnections. The number of connections can hardly affect the client. However, it is currently limited by the RPC framework.

    Disadvantages

    • TableAPI supports limited query operations such as get, scan, and limit. TableAPI does not support the aggregation or sorting feature in SQL mode.
    • TableAPI does not support complex transactions, such as interactive transactions. Unlike conventional relational databases, OceanBase Database is a NewSQL relational database that provides complete SQL functions. TableAPI is not designed for high scalability and availability.
    • TableAPI does not support global indexes and therefore does not support operations on tables with global indexes.

    KV model

    The KV model is essentially a simplified relational table model. When a table of the KV model is created, it has only two columns: K and V. This table is partitioned based on the K or the prefix of K. For example:

    create table kv (
    K varbinary(1024),
    V varbinary(1024),
    primary key(K)) partition by key(K) partitions 16;
    

    Previous topic

    Differences between replace and insert_or_update
    Last

    Next topic

    Introduction to the client and instructions for use
    Next
    What is on this page
    Table model
    Secondary index
    Security authentication
    Comparison with the SQL mode
    Advantages
    Disadvantages
    KV model