为什么 TRANSACTION_READ_COMMITTED 是 Java 中的默认值?
Why is TRANSACTION_READ_COMMITTED the default in Java?
交易教程在Using Transactions to Preserve Data Integrity部分解释:
The default transaction isolation level depends on your DBMS. For example, for Java DB, it is TRANSACTION_READ_COMMITTED.
对于我的 Postgresql 数据库,它是一样的。但这似乎不是最好的,因为只有 TRANSACTION_SERIALIZABLE
可以防止所有不一致:
Isolation Level │Transactions │Dirty Reads │Non-Repeatable Reads│Phantom Reads
=============================================================================================
TRANSACTION_NONE │Not supported│Not applicable│Not applicable │Not applicable
TRANSACTION_READ_COMMITTED │Supported │Prevented │Allowed │Allowed
TRANSACTION_READ_UNCOMMITTED│Supported │Allowed │Allowed │Allowed
TRANSACTION_REPEATABLE_READ │Supported │Prevented │Prevented │Allowed
TRANSACTION_SERIALIZABLE │Supported │Prevented │Prevented │Prevented
为什么最佳选项不是默认值?
交易教程在Using Transactions to Preserve Data Integrity部分解释:
The default transaction isolation level depends on your DBMS. For example, for Java DB, it is TRANSACTION_READ_COMMITTED.
对于我的 Postgresql 数据库,它是一样的。但这似乎不是最好的,因为只有 TRANSACTION_SERIALIZABLE
可以防止所有不一致:
Isolation Level │Transactions │Dirty Reads │Non-Repeatable Reads│Phantom Reads
=============================================================================================
TRANSACTION_NONE │Not supported│Not applicable│Not applicable │Not applicable
TRANSACTION_READ_COMMITTED │Supported │Prevented │Allowed │Allowed
TRANSACTION_READ_UNCOMMITTED│Supported │Allowed │Allowed │Allowed
TRANSACTION_REPEATABLE_READ │Supported │Prevented │Prevented │Allowed
TRANSACTION_SERIALIZABLE │Supported │Prevented │Prevented │Prevented
为什么最佳选项不是默认值?