All Products
Search
Document Center

ApsaraDB RDS:Transaction splitting

Last Updated:Mar 28, 2026

Transaction splitting offloads read requests inside non-auto-committed transactions from the primary instance to read-only instances—without application code changes. When all queries run inside transactions with autocommit disabled, the primary instance handles every request even though reads don't require write access. Transaction splitting routes those reads to read-only instances before any write begins, reducing load on the primary instance and improving its stability.

Prerequisites

Before you begin, ensure that you have:

How it works

By default, the database proxy sends all requests inside a transaction to the primary instance to preserve read/write consistency. This is necessary for write operations, but read requests that precede any write are also sent to the primary—even when read-only instances could serve them safely.

Transaction splitting changes this behavior when two conditions are met:

  • The transaction isolation level is READ COMMITTED (the PostgreSQL default).

  • Autocommit is disabled (autocommit = off).

Under these conditions, the proxy delays opening a transaction on the primary until the first write operation. All read requests issued before that write are routed to read-only instances via the load balancer.

Transaction splitting is enabled automatically when you enable the database proxy. It cannot be disabled.

Limitations

Not all transactions can be split. Make sure that transaction splitting is suitable for your workloads before you enable the database proxy.

ConstraintDetail
Explicit transactionsTransactions started with BEGIN or START TRANSACTION are never split. All requests in an explicit transaction go to the primary.
Global consistencyTransaction splitting cannot guarantee global consistency across requests. Evaluate this tradeoff before enabling the database proxy.
Cannot be disabledOnce the database proxy is enabled, transaction splitting is always active. There is no option to turn it off independently.

When to use transaction splitting

Transaction splitting works best when your application wraps read-heavy queries in non-auto-committed transactions without using explicit BEGIN or START TRANSACTION statements.

ScenarioSuitable?
Applications with autocommit disabled, mostly reads before writesYes
Explicit transactions using BEGIN or START TRANSACTIONNo — reads stay on the primary
Workloads requiring strict global consistency across all readsNo — global consistency cannot be ensured

API reference

OperationDescription
DescribeDBProxyQuery the details of a database proxy
DescribeDBProxyEndpointQuery the information about a database proxy endpoint