如何配置 yugabytedb 进行严格序列化?
How to configure yugabytedb for strict serialization?
从dbmsmusings门户了解到,金融交易需要严格的序列化,不遵守会导致异常。
请指导我配置 yugabytedb 以进行严格序列化,并且它会影响性能 and/or 功能。
YugabyteDB supports snapshot isolation
和 serializable isolation
.
1 种方法是在 BEGIN
上设置隔离级别:
yb_demo=# begin transaction isolation level serializable;
BEGIN
yb_demo=# SHOW transaction_isolation;
transaction_isolation
-----------------------
serializable
(1 row)
yb_demo=# commit;
COMMIT
yb_demo=# SHOW transaction_isolation;
transaction_isolation
-----------------------
read committed
(1 row)
另一种方法是使用 SET TRANSACTION
语句:
yb_demo=# begin;
BEGIN
yb_demo=# SHOW transaction_isolation;
transaction_isolation
-----------------------
read committed
(1 row)
yb_demo=# SET TRANSACTION ISOLATION LEVEL serializable;
SET
yb_demo=# SHOW transaction_isolation;
transaction_isolation
-----------------------
serializable
(1 row)
yb_demo=# commit;
COMMIT
从dbmsmusings门户了解到,金融交易需要严格的序列化,不遵守会导致异常。
请指导我配置 yugabytedb 以进行严格序列化,并且它会影响性能 and/or 功能。
YugabyteDB supports snapshot isolation
和 serializable isolation
.
1 种方法是在 BEGIN
上设置隔离级别:
yb_demo=# begin transaction isolation level serializable;
BEGIN
yb_demo=# SHOW transaction_isolation;
transaction_isolation
-----------------------
serializable
(1 row)
yb_demo=# commit;
COMMIT
yb_demo=# SHOW transaction_isolation;
transaction_isolation
-----------------------
read committed
(1 row)
另一种方法是使用 SET TRANSACTION
语句:
yb_demo=# begin;
BEGIN
yb_demo=# SHOW transaction_isolation;
transaction_isolation
-----------------------
read committed
(1 row)
yb_demo=# SET TRANSACTION ISOLATION LEVEL serializable;
SET
yb_demo=# SHOW transaction_isolation;
transaction_isolation
-----------------------
serializable
(1 row)
yb_demo=# commit;
COMMIT