Adjust indexscan planning logic to keep RestrictInfo nodes associated
Tom Lane <tgl@sss.pgh.pa.us>
Adjust indexscan planning logic to keep RestrictInfo nodes associated with index qual clauses in the Path representation. This saves a little work during createplan and (probably more importantly) allows reuse of cached selectivity estimates during indexscan planning. Also fix latent bug: wrong plan would have been generated for a 'special operator' used in a nestloop-inner-indexscan join qual, because the special operator would not have gotten into the list of quals to recheck. This bug is only latent because at present the special-operator code could never trigger on a join qual, but sooner or later someone will want to do it.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/nodes/outfuncs.c | modified | +4 −3 |
| src/backend/optimizer/path/costsize.c | modified | +4 −1 |
| src/backend/optimizer/path/indxpath.c | modified | +77 −28 |
| src/backend/optimizer/path/orindxpath.c | modified | +33 −31 |
| src/backend/optimizer/plan/createplan.c | modified | +129 −68 |
| src/backend/optimizer/util/pathnode.c | modified | +9 −5 |
| src/backend/optimizer/util/restrictinfo.c | modified | +94 −25 |
| src/backend/utils/adt/selfuncs.c | modified | +22 −6 |
| src/include/nodes/relation.h | modified | +21 −19 |
| src/include/optimizer/paths.h | modified | +3 −1 |
| src/include/optimizer/restrictinfo.h | modified | +4 −1 |