Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.hypertrace.core.documentstore.postgres;

import static java.sql.Connection.TRANSACTION_READ_COMMITTED;

import java.sql.Connection;
import java.sql.SQLException;
import java.time.Duration;
Expand Down Expand Up @@ -101,7 +99,10 @@ private void setFactoryProperties(
poolableConnectionFactory.setValidationQueryTimeout((int) VALIDATION_QUERY_TIMEOUT.toSeconds());
poolableConnectionFactory.setDefaultReadOnly(false);
poolableConnectionFactory.setDefaultAutoCommit(true);
poolableConnectionFactory.setDefaultTransactionIsolation(TRANSACTION_READ_COMMITTED);
// Note: We intentionally do NOT call setDefaultTransactionIsolation() here.
// PostgreSQL defaults to READ_COMMITTED, which is what we want. Setting it explicitly
// causes DBCP2 to execute "SHOW TRANSACTION ISOLATION LEVEL" on every connection borrow
// (via PgConnection.getTransactionIsolation()), adding unnecessary overhead.
poolableConnectionFactory.setPoolStatements(false);
}

Expand Down
Loading