Changing Isolation Levels

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

Original topic: 更改隔离级别

| username: 胡杨树旁

I want to modify the global isolation level, but an error occurred.

| username: 裤衩儿飞上天 | Original post link

The image is not visible. Please provide the text you need translated.

| username: db_user | Original post link

Currently, the isolation level of Read Uncommitted is not supported.

| username: 胡杨树旁 | Original post link

Now it reports this error.

| username: Billmay表妹 | Original post link

The default isolation level of TiDB is Repeatable Read. If you want to change the global isolation level, you can use the following command:

SET GLOBAL tidb_txn_mode='pessimistic';

This will change the global isolation level to Pessimistic Transaction mode. However, if you encounter an error when executing this command, it could be due to one of the following reasons:

  1. You do not have sufficient privileges to modify the global isolation level. Please ensure you have the necessary permissions to modify global variables. You can check your permissions using the following command:

    SHOW GRANTS FOR CURRENT_USER;
    
  2. The TiDB version you are using does not support Pessimistic Transaction mode. Please ensure that the TiDB version you are using is v3.0.7 or higher. You can check the TiDB version you are using with the following command:

    SELECT tidb_version();
    

If you have checked the above two aspects but still cannot modify the global isolation level, please try seeking help on the TiDB community forum.

| username: 裤衩儿飞上天 | Original post link

Referring to @db_user’s reply, TiDB only supports RC and RR.

| username: 胡杨树旁 | Original post link

The RC isolation level can be modified normally.

| username: db_user | Original post link

RC is Read Committed. Isn’t it written as supported in the screenshot above? Didn’t you change it to Read Uncommitted? This is not supported.

| username: 胡杨树旁 | Original post link

Yes, ru does not support modification, others can be modified. Thank you, boss.

| username: db_user | Original post link

You’re welcome. I’m quite curious about what kind of business would use the read uncommitted isolation level.

| username: 胡杨树旁 | Original post link

The business scenario does not use it, but I thought that in a MySQL environment, the isolation level can be modified, so I wanted to test the isolation level situation in a TiDB environment.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.