Summary:
D34040 introduced a framework to skip redundant secondary index updates and foreign key checks.
This revision adds a PG preview flag `ysql_yb_update_optimization_infra` that keeps the feature turned OFF by default.
Additionally, this revision restricts lookup to this flag to the following locations:.
- Once, during query rewriting to determine to set the wholerow junk attribute
- Once, at planning time to determine if optimization metadata needs to be computed
- Once, at the beginning of query execution (`ExecInitModifyTable`) to determine if we should go ahead with the optimization. This has three possibilities:
- The feature was enabled at planning time and disabled now (during query execution). In this case optimization is not performed.
- The feature was disabled at planning time and enabled now. In this case, there is no metadata to perform the optimization and so the optimization is skipped.
- The features was enabled at planning time and enabled now. In this case, metadata is available and the optimization is performed.
To turn on the update optimization feature, do the following:
- Append `ysql_yb_update_optimization_infra` to the list of flags in `allowed_preview_flags_csv`
- Set the tserver gflag `ysql_yb_update_optimization_infra` to true.
Jira: DB-7701
Test Plan:
Run the following tests:
```
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressUpdateOptimized#schedule'
```
Reviewers: amartsinchyk
Reviewed By: amartsinchyk
Subscribers: ybase, smishra, yql
Tags: #jenkins-ready
Differential Revision: https://phorge.dev.yugabyte.com/D37746