-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move optimizer_enable_query_parameter GUC to Orca extension #1172
base: feature/ADBDEV-6552
Are you sure you want to change the base?
Changes from all commits
4d5dc89
583ecc3
93a84d0
2b7632b
65a944c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,9 @@ | |
((plansource)->raw_parse_tree && \ | ||
IsA((plansource)->raw_parse_tree->stmt, TransactionStmt)) | ||
|
||
/* hooks */ | ||
choose_custom_plan_hook_type choose_custom_plan_hook = NULL; | ||
|
||
/* | ||
* This is the head of the backend's list of "saved" CachedPlanSources (i.e., | ||
* those that are in long-lived storage and are examined for sinval events). | ||
|
@@ -1088,9 +1091,16 @@ choose_custom_plan(CachedPlanSource *plansource, ParamListInfo boundParams, Into | |
if (plansource->cursor_options & CURSOR_OPT_CUSTOM_PLAN) | ||
return true; | ||
|
||
/* Generate custom plans if optimizer_enable_query_parameter is disabled and Orca is enabled */ | ||
if (optimizer && !optimizer_enable_query_parameter) | ||
return true; | ||
/* See if extension wants to force the decision */ | ||
if (choose_custom_plan_hook != NULL) | ||
{ | ||
PlanCacheMode mode = choose_custom_plan_hook(plansource, boundParams, intoClause); | ||
|
||
if (mode == PLAN_CACHE_MODE_FORCE_GENERIC_PLAN) | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was such a return possible before the patch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Speaking about Orca - Overall, the delta should preserve previous logic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can we use it instead of the new hook? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about it, but that means we'll need to change This approach seems too error prone, so I decided not go this route. |
||
if (mode == PLAN_CACHE_MODE_FORCE_CUSTOM_PLAN) | ||
return true; | ||
} | ||
|
||
/* Generate custom plans until we have done at least 5 (arbitrary) */ | ||
if (plansource->num_custom_plans < 5) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can multiple extensions set their own hooks in
choose_custom_plan_hook
that return different results? And what to do about it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory it is possible, but I think that only planner extension would be interested in using
choose_custom_plan_hook
, and we do not support more than one external planner at the same time currently. So I guess currently it doesn't sound like a real problem.