Concurrency refers to the simultaneous execution of multiple transactions. An application with higher concurrency performance has better extensibility. An extensible application can handle larger workloads but also need to consume more system resources.
Concurrent transactions must produce meaningful and consistent results. Therefore, a multi-user database must provide the following capabilities:
Data concurrency, which ensures that multiple users can access data at the same time.
Data consistency, which ensures that all users can see a consistent view of data, including their own transactions and visible changes to transactions committed by other users.
OceanBase Database maintains data consistency by using the multiversion consistency model, various types of locks, and different transaction isolation levels.
OceanBase Database in Oracle mode provides tenants with multiple features for improving concurrency and extensibility, for example, sequences, non-blocking read/write, and shared SQL.
Sequences, auto-increment columns, and concurrency
A sequence is a schema object through which multiple users can generate globally unique integers. It is very useful when you need a unique primary key. The sequence of OceanBase Database can also provide globally unique and consecutive integers even in a distributed architecture.
Without a sequence, the unique primary key can be generated only through programming. You can select a recently generated value and then increase it to generate a new primary key value. This technique requires that this value be locked during a transaction, which causes multiple users to wait for the next primary key value. This is called transaction serialization. Sequences can eliminate serialization. This improves the concurrency and extensibility of the application.
Sequences are specific to Oracle tenants. An auto-increment column is a type of numeric data. By default, the database fills the column with incremental numbers that are unique.
For users, auto-increment columns achieve the same effect as sequences.
Non-blocking read/write and concurrency
In OceanBase Database, the non-blocking read/write feature allows data to be queried while it is being modified, without blocking or stopping the query operations. This feature allows one session to read the data that another session is modifying, and ensures that the read data is not dirty data.
In OceanBase Database, this feature is implemented based on multiple versions and requires no locks.