云数据库 GaussDB-SET TRANSACTION:示例

时间:2025-01-26 10:48:52

示例

--开启一个事务,设置事务的隔离级别为READ COMMITTED,访问模式为READ ONLY。gaussdb=# START TRANSACTION;gaussdb=# SET LOCAL TRANSACTION ISOLATION LEVEL READ COMMITTED READ ONLY;gaussdb=# COMMIT;--设置当前会话的事务隔离级别、读写模式。--在sql_compatibility = 'B'场景下,b_format_behavior_compat_options设置为set_session_transaction。gaussdb=# SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;gaussdb=# SET SESSION TRANSACTION READ ONLY;--设置当前数据库全局会话的事务隔离级别、读写模式(sql_compatibility = 'B'场景下)。gaussdb=# SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;gaussdb=# SET GLOBAL TRANSACTION READ ONLY;
support.huaweicloud.com/centralized-devg-v3-gaussdb/gaussdb-42-0655.html