Skip to content
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

README: add caveat (prepared queries) #36

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ And this time, the specific configuration is applied.
Caveats
--------

`pg_query_settings` doesn't work well with **prepared queries**. These are
considered as not supported yet. This will be fixed in future releases.

Enabling this extension might have a performance impact on any workloads
with a high number of fast queries, as it slighlty increases the time taken
to compute the query plan. The more entries in the table, the greater the
Expand Down
10 changes: 10 additions & 0 deletions pg_query_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ execPlantuner(Query *parse, const char *query_st, int cursorOptions, ParamListIn
static void
PlanTuner_ExecutorEnd(QueryDesc *q)
{
/* FIXME: here, we restore the value of each parameter, but that's a problem
* for prepared queries. More specifically:
* for a given parameter `P`, if the generic plan is selected, and if the executor
* needs to fetch the value of `P`, then it won't get the value specified in the
* `pgqs_config` table.
* For example, the executor fetches the value of `work_mem`
* in order to decide whether to perform an in-memory sort, but at this point the
* value would have been reset to its default (at the end of the PREPARE statement).
* However, there's no problem with parameters that only affect planification, such
* as max_parallel_workers_per_gather. */
DestroyPRList(true);

if (prev_ExecutorEnd)
Expand Down