This topic describes the transaction specifications of OceanBase Database.
OceanBase Database V3.x does not impose a size limit on large transactions. However, you must properly control the concurrency level to prevent a surge in memory usage.
The number of constant values in the
INlist in theWHEREclause is not limited by the transaction size.When initializing an OBServer node, write throttling is enabled when the memory usage of the MemStore reaches 80%. This prevents excessive memory consumption during startup.
alter system set writing_throttling_trigger_percentage = 80 TENANT = ALL;
Notice
Throttling limits the speed at which clogs are replayed, which may affect the timing of minor compactions.
When operating on data in batches, the program must be capable of interrupt handling and have a retry mechanism for transaction failures.
Since OceanBase's distributed transactions use the two-phase commit protocol, the system requires mechanisms for transaction failure retry and pending transaction status checks to determine execution status.
In the frontend program, use of set statements other than
set namesis prohibited, including similar commands such asset timezone,set SQL_mode, andset isolation_level.Sequences are useful when a unique primary key is required, as they can provide globally unique and consecutive integers.
Limit the concurrency of sessions.
If a tenant has n CPUs, it typically supports at most
10*nactive user sessions. Any additional concurrent session requests will wait for an available worker thread before becoming active.Enable automatic transaction commit. It is not recommended to execute
set @@autocommit=xx; instead, use theConnection.setAutoCommit(xx)method.Start a transaction. It is not recommended to execute
start transaction/begin; instead, use theConnection.setAutoCommit(xx)interface.Commit transactions. Executing
commit/rollbackis not recommended; instead, use theConnection.commit()orConnection.rollback()methods.