If I change the MySQL isolation level for each transaction, what is the load on the DB?

Asked 1 years ago, Updated 1 years ago, 400 views

I'm using TypeORM as the ORM for Node.js, but when I look at the document (https://typeorm.io/#/transactions),

import {getManager} from "typeorm";
wait getManager().transaction("SERIALIZABLE", transactionalEntityManager=>{

});

The separation level could be changed for each transaction as shown in .

Every time you check the query log before starting a transaction,

SET TRANSACTION ISOLATION LEVEL...

I changed the isolation level in , but I recognize the isolation level as a global setting.
Is it okay to change it so often?If you change the isolation level, what you do inside the DB will change a lot when you update...

mysql node.js

2022-09-30 21:50

1 Answers

The isolation level is recognized as a global setting.

According to the MySQL 5.6 Reference Manual 13.3.6 SET TRANSACTION syntax,
SET TRANSACTION ISOLATION LEVEL... seems to be targeted for transactions that run within the current session. *It may vary depending on the version of MySQL

Is it okay to change it that often?

"If it is a change for each session, I think it is within the assumption of ""specification that allows you to change the separation level for each transaction."""
The following conditions are required to change the transaction level for all sessions, so you will not be able to change them frequently:

  • Requires SUPER privileges
  • No active transactions exist

If you change the isolation level, what you do inside the DB will change a lot when you update...

Unfortunately, I cannot comment on my level of knowledge.
I think the following page will help you with your behavior from the outside.
Summary of transaction isolation levels


2022-09-30 21:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.