Modify planner's implied-equality-deduction code so that when a set
Tom Lane <tgl@sss.pgh.pa.us>
Modify planner's implied-equality-deduction code so that when a set of known-equal expressions includes any constant expressions (including Params from outer queries), we actively suppress any 'var = var' clauses that are or could be deduced from the set, generating only the deducible 'var = const' clauses instead. The idea here is to push down the restrictions implied by the equality set to base relations whenever possible. Once we have applied the 'var = const' clauses, the 'var = var' clauses are redundant, and should be suppressed both to save work at execution and to avoid double-counting restrictivity.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/nodes/list.c | modified | +17 −1 |
| src/backend/optimizer/path/indxpath.c | modified | +6 −4 |
| src/backend/optimizer/path/pathkeys.c | modified | +111 −10 |
| src/backend/optimizer/plan/initsplan.c | modified | +94 −134 |
| src/backend/optimizer/util/joininfo.c | modified | +109 −1 |
| src/backend/optimizer/util/relnode.c | modified | +9 −4 |
| src/backend/optimizer/util/restrictinfo.c | modified | +25 −3 |
| src/backend/utils/adt/selfuncs.c | modified | +2 −2 |
| src/include/nodes/pg_list.h | modified | +2 −1 |
| src/include/optimizer/joininfo.h | modified | +11 −3 |
| src/include/optimizer/paths.h | modified | +3 −1 |
| src/include/optimizer/planmain.h | modified | +6 −4 |