Conditions for Using the Pessimistic Transaction Model in TiDB Version 6.1.7

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb 6.1.7版本悲观事务模型使用条件

| username: xxxxxxxx

[TiDB Usage Environment] Production Environment Poc
[TiDB Version] 6.1.7

I want to confirm, in version 6.1.7, if I want to use pessimistic locking, after enabling the following parameter:

SET GLOBAL tidb_txn_mode = 'pessimistic';

do I also need to explicitly start a transaction to use pessimistic transactions?

The official documentation introduces it as follows:

| username: WalterWj | Original post link

Yes, that’s correct.

| username: stephanie | Original post link

Yes, just follow the instructions in the documentation.

| username: wangkk2024 | Original post link

Learned.

| username: TiDBer_QYr0vohO | Original post link

Yes.