Support parameter passing to foreign server #293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for forwarding on parameters of prepared statements to MySQL, and adds a cache for same to support statement reuse.
For example, given:
The
execute
call now uses:Instead of a query using constant value. Sending on the parameters allows MySQL to cache & re-use the plan.
NOTE the Postgres setting
plan_cache_mode
should be set toforce_generic_plan
for this patch to have impact. Otherwise, Postgres may create a plan that replaces the parameters before handing the plan to the FDW, breaking the forwarding of the parameters to the foreign server.In testing with
go-ycsb
I have seen an improvement in throughput and improved latency. This is largely due to the nature of the benchmark (lots of the same queries with parameters), but without this patch the same benchmark performs very poorly as the mysql side needs to rebuild the plan on each statement.