哪个是插入行的最佳事务隔离级别?

Which is the best transaction isolation level for insert row?

我需要了解我可以用来做这两件事的最佳事务隔离:

  1. 在tableA中保存一行
  2. 在tableB中保存一行

我知道如果我使用类似事务隔离 SERIALIZABLE,它工作正常,但我需要知道我是否可以使用 READ_COMMITEDREPEATEBLE_READ。我在两个不同的 table 中只保存了两行,所以我没有进行 READ 操作,所以我认为 READ_COMMIT 是最好的解决方案?谁能帮帮我?

是否要求新的A行和B行一起持久化,并且只能一起可见?如果你什么都不看,而且你对 A 和 B 不一定一起出现感到满意,那么你甚至不需要在这里进行交易。

这是一篇很好的相关读物:https://www.sqlpassion.at/archive/2014/01/21/myths-and-misconceptions-about-transaction-isolation-levels/

还有,下面和我之前说的矛盾(这里,已经removed/updated了):

https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/transaction-isolation-levels?view=sql-server-2017

Read Uncommitted: Transactions are not isolated from each other. If the DBMS supports other transaction isolation levels, it ignores whatever mechanism it uses to implement those levels. So that they do not adversely affect other transactions, transactions running at the Read Uncommitted level are usually read-only.

它也很好地描述了其他州。听起来 Read committed 在这里最好。

Read Committed: The transaction holds a read lock (if it only reads the row) or write lock (if it updates or deletes the row) on the current row to prevent other transactions from updating or deleting it. The transaction releases read locks when it moves off the current row. It holds write locks until it is committed or rolled back.

这将使您在评论中提到的删除和插入操作安全进行。