Skip to content

Commit

Permalink
[#18822] YSQL: Re-enable feature to skip redundant index updates
Browse files Browse the repository at this point in the history
Summary:
Timeline:

D34040 introduced an optimization to skip redundant index updates and foreign key checks.
D37746 gated this feature behind a preview flag (feature is OFF by default) named yb_update_optimization_infra.
D37749 introduced a feature enablement flag ysql_yb_skip_redundant_update_ops, and promoted the above preview flag to an auto flag.
D40300 turned OFF the feature via the enablement flag ysql_yb_skip_redundant_update_ops due to the bug GH-25075.
D40404 fixed the above bug.

This revision turns ON the feature by default by turning ON the feature enablement flag ysql_yb_skip_redundant_update_ops.
This reverts commit 0529391 (D40300).
Jira: DB-7701

Test Plan: Run Jenkins

Reviewers: amartsinchyk, smishra

Reviewed By: amartsinchyk

Subscribers: ybase, yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D40649
  • Loading branch information
karthik-ramanathan-3006 committed Dec 16, 2024
1 parent ed874b9 commit 3c8a0c5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ public void testOnConflict() throws Exception {
.plans(resultNodeChecker
.storageTableReadRequests(Checkers.equal(1))
.storageTableWriteRequests(Checkers.equal(1))
.storageIndexWriteRequests(Checkers.equal(TEST_NUM_SEC_INDEXES))
.build())
.build())
.storageFlushRequests(Checkers.equal(1))
Expand Down Expand Up @@ -304,15 +303,15 @@ public void testOnConflict() throws Exception {
{
Checker checker = topLevelChecker
.plan(insertNodeChecker
.plans(resultNodeChecker
.plans(makePlanBuilder()
.nodeType(NODE_RESULT)
.storageTableReadRequests(Checkers.equal(1))
.storageTableWriteRequests(Checkers.equal(1))
.storageIndexWriteRequests(Checkers.equal(TEST_NUM_SEC_INDEXES * 2))
.build())
.build())
.storageFlushRequests(Checkers.equal(2))
.storageFlushRequests(Checkers.equal(1))
.storageReadRequests(Checkers.equal(1))
.storageWriteRequests(Checkers.equal((TEST_NUM_SEC_INDEXES * 2) + 1))
.storageWriteRequests(Checkers.equal(1))
.build();

testExplain(String.format(insertWithOnConflict, TEST_TABLE, "(1, 1, 1, 1, 1)", "k",
Expand Down
2 changes: 1 addition & 1 deletion src/postgres/src/backend/utils/misc/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2997,7 +2997,7 @@ static struct config_bool ConfigureNamesBool[] =
GUC_NOT_IN_SAMPLE
},
&yb_update_optimization_options.is_enabled,
false,
true,
NULL, NULL, NULL
},

Expand Down
2 changes: 1 addition & 1 deletion src/postgres/src/backend/utils/misc/pg_yb_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@ bool yb_enable_inplace_index_update = true;

YBUpdateOptimizationOptions yb_update_optimization_options = {
.has_infra = true,
.is_enabled = false,
.is_enabled = true,
.num_cols_to_compare = 50,
.max_cols_size_to_compare = 10 * 1024
};
Expand Down
2 changes: 1 addition & 1 deletion src/yb/common/common_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ DEFINE_RUNTIME_AUTO_PG_FLAG(bool, yb_update_optimization_infra, kLocalPersisted,
"(but not limited to) skipping redundant secondary index updates "
"and redundant constraint checks.");

DEFINE_RUNTIME_PG_FLAG(bool, yb_skip_redundant_update_ops, false,
DEFINE_RUNTIME_PG_FLAG(bool, yb_skip_redundant_update_ops, true,
"Enables the comparison of old and new values of columns specified in the "
"SET clause of YSQL UPDATE queries to skip redundant secondary index "
"updates and redundant constraint checks.");
Expand Down

0 comments on commit 3c8a0c5

Please sign in to comment.