Skip to content

Commit 83a19e4

Browse files
committed
Change prepareThreshold to 1 as default
1 parent 0be2b6a commit 83a19e4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

jdbc-yugabytedb/src/main/java/org/postgresql/PGProperty.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public enum PGProperty {
9191
* Sets the default threshold for enabling server-side prepare. A value of {@code -1} stands for
9292
* forceBinary
9393
*/
94-
PREPARE_THRESHOLD("prepareThreshold", "5",
94+
PREPARE_THRESHOLD("prepareThreshold", "1",
9595
"Statement prepare threshold. A value of {@code -1} stands for forceBinary"),
9696

9797
/**

jdbc-yugabytedb/src/test/java/org/postgresql/test/jdbc2/PreparedStatementTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ public void testStatementDescribe() throws SQLException {
13191319
}
13201320

13211321
@Test
1322-
public void testBatchWithPrepareThreshold5() throws SQLException {
1322+
public void testBatchWithPrepareThreshold1() throws SQLException {
13231323
assumeBinaryModeRegular();
13241324
Assume.assumeTrue("simple protocol only does not support prepared statement requests",
13251325
preferQueryMode != PreferQueryMode.SIMPLE);
@@ -1331,7 +1331,7 @@ public void testBatchWithPrepareThreshold5() throws SQLException {
13311331
// When using a prepareThreshold of 5, a batch update should use server-side prepare
13321332
pstmt = con.prepareStatement("INSERT INTO batch_tab_threshold5 (id, val) VALUES (?,?)");
13331333
((PgStatement) pstmt).setPrepareThreshold(5);
1334-
for (int p = 0; p < 5; p++) {
1334+
for (int p = 0; p < 1; p++) {
13351335
for (int i = 0; i <= 5; i++) {
13361336
pstmt.setLong(1, i);
13371337
pstmt.setLong(2, i);
@@ -1340,9 +1340,9 @@ public void testBatchWithPrepareThreshold5() throws SQLException {
13401340
pstmt.executeBatch();
13411341
}
13421342
pstmt.close();
1343-
assertTrue("prepareThreshold=5, so the statement should be server-prepared",
1343+
assertTrue("prepareThreshold=1, so the statement should be server-prepared",
13441344
((PGStatement) pstmt).isUseServerPrepare());
1345-
assertEquals("prepareThreshold=5, so the statement should be server-prepared", 1,
1345+
assertEquals("prepareThreshold=1, so the statement should be server-prepared", 1,
13461346
getNumberOfServerPreparedStatements("INSERT INTO batch_tab_threshold5 (id, val) VALUES ($1,$2)"));
13471347
}
13481348

0 commit comments

Comments
 (0)