summaryrefslogtreecommitdiff
path: root/src/backend/utils/syscache.h
diff options
context:
space:
mode:
authorRobert Haas2026-09-17 15:15:52 +0000
committerRobert Haas2026-09-17 15:15:52 +0000
commite1d8f81d4961ca6c4228eb9a3ab5d36168008e42 (patch)
treecfb037a522311f65df6530c84628ed81630920e8 /src/backend/utils/syscache.h
parentc9c660e6ae03027615adff90cf4b26da5f8f97c1 (diff)
pg_plan_advice: Fix defects in JOIN_ORDER advice feedback.HEADmaster
This commit fixes several related problems. All of these problems escaped testing for the same reason: they do not occur when only generated advice is supplied, and therefore test_plan_advice was incapable of detecting these shortcomings. First, prior to this commit, the advice feedback code never regarded an unordered sublist of a JOIN_ORDER specification as matching an unrolled join. As a result, when JOIN_ORDER() advice contained unordered sublists, the advice feedback tended to be "matched, failed" even when the advice worked exactly as intended. Only the case where an unordered sublist was implemented by a plan shape not subject to unrolling, such as a partitionwise join, worked properly. Second, prior to this commit, a join order sublist in the initial position wasn't properly handled. Note that this overlaps with the problem described in the previous paragraph; JOIN_ORDER({a b} c) was broken both because of the unordered sublist and because of the sublist being in the initial position. However, there's more to this case: JOIN_ORDER((a b) c) means the same as JOIN_ORDER(a b c), but the advice feedback code didn't know that, and would generate "matched, failed" for the former case even when everything was working. Finally, prior to this commit, advice feedback didn't correctly handle single-element sublists. Those are pretty nonsensical, since by definition a join involves at least 2 tables, so we could just ban that case. Instead, at least for now, I've chosen to make advice feedback handle such cases in the same way that advice enforcement already does: the extra grouping levels are simply disregarded, so that JOIN_ORDER({a} ((b))) is enforced in the same way as, and also gets the same advice feedback as, JOIN_ORDER(a b). Reported-by: Noah Misch <noah@leadboat.com> Backpatch-through: 19 Discussion: https://postgr.es/m/CA+TgmoYmXy-jiP5qDhqNEiYFEBzQsArO6O2d9E8szNZqi1bePQ@mail.gmail.com Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Diffstat (limited to 'src/backend/utils/syscache.h')
0 files changed, 0 insertions, 0 deletions