File tree Expand file tree Collapse file tree
document-store/src/main/java/org/hypertrace/core/documentstore/postgres Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .hypertrace .core .documentstore .postgres ;
22
3- import static java .sql .Connection .TRANSACTION_READ_COMMITTED ;
4-
53import java .sql .Connection ;
64import java .sql .SQLException ;
75import 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
You can’t perform that action at this time.
0 commit comments