Skip to content

Commit 3bcae6c

Browse files
authored
Remove transaction isolation level config (#306)
1 parent daf5ccb commit 3bcae6c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

document-store/src/main/java/org/hypertrace/core/documentstore/postgres/PostgresConnectionPool.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package org.hypertrace.core.documentstore.postgres;
22

3-
import static java.sql.Connection.TRANSACTION_READ_COMMITTED;
4-
53
import java.sql.Connection;
64
import java.sql.SQLException;
75
import java.time.Duration;
@@ -101,7 +99,10 @@ private void setFactoryProperties(
10199
poolableConnectionFactory.setValidationQueryTimeout((int) VALIDATION_QUERY_TIMEOUT.toSeconds());
102100
poolableConnectionFactory.setDefaultReadOnly(false);
103101
poolableConnectionFactory.setDefaultAutoCommit(true);
104-
poolableConnectionFactory.setDefaultTransactionIsolation(TRANSACTION_READ_COMMITTED);
102+
// Note: We intentionally do NOT call setDefaultTransactionIsolation() here.
103+
// PostgreSQL defaults to READ_COMMITTED, which is what we want. Setting it explicitly
104+
// causes DBCP2 to execute "SHOW TRANSACTION ISOLATION LEVEL" on every connection borrow
105+
// (via PgConnection.getTransactionIsolation()), adding unnecessary overhead.
105106
poolableConnectionFactory.setPoolStatements(false);
106107
}
107108

0 commit comments

Comments
 (0)