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

    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.2.2
    iconOceanBase Database
    SQL - V 4.2.2
    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

    Read/Write splitting

    Last Updated:2026-04-15 08:27:14  Updated
    share
    What is on this page
    Configure read/write splitting
    Configure weak-consistency read
    Modify the routing strategy

    folded

    share

    In read/write splitting, after data is modified on the primary server, the modification will be synchronized to the standby server. The standby server provides only data reads and no data writes. This optimizes the database performance and improves server security while backing up the database. In read/write splitting for a standalone database such as a MySQL database, write requests are sent to the primary server and read requests are sent to the standby server. OceanBase Database uniquely refines read/write splitting from the server level to the partition level.

    With the read/write splitting feature, read requests can be sent to followers to reduce the stress on leaders.

    Notice

    After read/write splitting is enabled, read requests may not read the latest data, and the latency is about hundreds of milliseconds.

    Configure read/write splitting

    To use read/write splitting, you must:

    1. Configure weak consistency read for SQL statements. A weak consistency read request does not need to read the latest data. Strong-consistency read is enabled for general SQL statements and weak consistency read requires additional configurations.
    2. Modify the routing strategy. For example, for partition1 in the following figure, the three replicas including the leader can provide weak-consistency read services. You can modify the routing strategy so that read requests are preferentially routed to the followers.

    Read/Write splitting

    Configure weak-consistency read

    Configure weak-consistency read by using a hint

    You can add the /*+READ_CONSISTENCY(WEAK)*/ hint to SQL statements to enable weak consistency read for the statements.

    select /*+READ_CONSISTENCY(WEAK)*/ * from t1;
    

    Configure weak-consistency read by using a parameter

    To configure weak consistency read for SQL statements by using a hint, you must modify the SQL statements, which can be complex sometimes. You can change the value of the parameter obproxy_read_consistency to configure weak consistency read.

    1. Log on to the database by using the administrator account of ODP.

    2. Change the value of the obproxy_read_consistency parameter.

      alter proxyconfig set obproxy_read_consistency = 1;
      

    Note

    The valid values of this parameter are 0 and 1. The default value is 0, which specifies to enable strong consistency read. A strong consistency read request reads the latest data. The value 1 specifies to enable weak consistency read.

    Modify the routing strategy

    ODP allows you to modify the routing strategy by using the proxy_route_policy parameter. You can set the value to follower_first or follower_only so that weak consistency read requests are preferentially sent to followers.

    • follower_first: Read requests are preferentially sent to followers. If all the followers are unavailable, the requests are sent to the leader.
    • follower_only: Read requests are sent only to the followers. If all the followers are unavailable, the connection to the client is terminated. Select a routing strategy based on the business scenario.

    Previous topic

    LDC-based routing
    Last

    Next topic

    Follower-first read
    Next
    What is on this page
    Configure read/write splitting
    Configure weak-consistency read
    Modify the routing strategy