I understand the concept of isolation w.r.t transactions. I want to know whether I can set the default isolation level for the entire database / a particular table in a database.
I want to do this because i understand that increasing the isolation level can impact performance so i want to restrict the change to a few tables in the entire DB.
CodePudding user response:
You can set the transaction isolation level for a session. Or for the server. But not for one table.
As a workaround, you can set the desired isolation level immediately before you operate on that single table. Just stay aware that you've set the isolation level for your session.
i understand that increasing the isolation level can impact performance
Have you measured the impact?
CodePudding user response:
If you are using a database eg. Mysql that support multiple engine, then you can create your special table with a special engine eg. memory.
Then your query can fetch rows from most tables with the isolation level of current session, and fetch rows from the special table with the only isolation level for the special engine.
It is not a general solution for your problem, but it may help in some cases.