View isolation level for a query in mysql

后端 未结 1 957
情深已故
情深已故 2020-12-24 14:02

How do I determine the isolation level in use for a given query? After a query is executed (by a 3rd party application) I\'d like to know which isolation level was used (e.g

相关标签:
1条回答
  • 2020-12-24 15:05
    SHOW VARIABLES LIKE 'tx_isolation';
    

    or if you have MySQL 5.1+

    SELECT * FROM information_schema.session_variables
    WHERE variable_name = 'tx_isolation';
    

    If you want to know what the server has configured globally, change the above to the following:

    SHOW GLOBAL VARIABLES LIKE 'tx_isolation';
    

    or if you have MySQL 5.1+

    SELECT * FROM information_schema.global_variables
    WHERE variable_name = 'tx_isolation';
    

    If you want to make the query reveal what transaction isolation is being used, run this:

    SELECT variable_value IsolationLevel
    FROM information_schema.session_variables
    WHERE variable_name = 'tx_isolation';
    

    DISCLAIMER : I DO NOT KNOW EF4

    If you are allowed to embed subqueries in the SQL about to be run by EF4, you may have to embed this query as a subquery (or embed you query as a subquery) and display the variable IsolationLevel along with the results of the actual query.

    0 讨论(0)
提交回复
热议问题