Full-query pushdown support for FDW#615
Open
bnjjj wants to merge 4 commits into
Open
Conversation
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds “full-query pushdown” plumbing to supabase-wrappers, allowing wrappers-based FDWs to execute an entire planned SQL statement remotely (including joins/upper ops) and return only final rows to PostgreSQL.
Changes:
- Introduces full-query remote execution state (
FullQuery, relations, parameters, policy/context) and wires it into planner join/upper paths plus executor scan dispatch. - Reworks FDW plan state handling to avoid storing transient planner pointers in cached plans (JSON snapshot for full-query plans; cloned plan templates for legacy scans).
- Adds
serde/serde_jsondependencies to support serializing full-query plan snapshots.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| supabase-wrappers/src/utils.rs | Makes list deserialization safer by avoiding an unconditional unwrap. |
| supabase-wrappers/src/upper.rs | Adds a full-query upper-path option and improves null-safety in planner extraction helpers. |
| supabase-wrappers/src/scan.rs | Implements full-query planning/execution path, plan snapshot serialization, and parameter capture for remote queries. |
| supabase-wrappers/src/interface.rs | Adds full-query types and introduces remote_query_policy / begin_remote_query hooks for FDWs. |
| supabase-wrappers/Cargo.toml | Adds serde + serde_json dependencies needed for plan snapshotting. |
| Cargo.lock | Locks new serde-related dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1650
to
+1653
| match param.eval_value.lock() { | ||
| Ok(mut eval_value) => *eval_value = current_value, | ||
| Err(_) => debug2!("parameter evaluation cache lock was poisoned"), | ||
| } |
Comment on lines
+1708
to
+1714
| let value = match param.eval_value.lock() { | ||
| Ok(value) => value.clone(), | ||
| Err(_) => { | ||
| debug2!("remote-query parameter cache lock was poisoned"); | ||
| None | ||
| } | ||
| }; |
Comment on lines
+1063
to
+1065
| /// If enabled, wrappers may add foreign join or upper paths that call | ||
| /// [`begin_full_query_scan`] instead of decomposing the query into base | ||
| /// scans, filters, joins, aggregates, and projections executed by Postgres. |
Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implement full-query pushdown support for FDWs built on supabase-wrappers.
The goal is to let an FDW act as a thin bridge to a remote execution engine: PostgreSQL can still participate in planning, but the selected query can be sent as one remote SQL statement instead of being decomposed into scan callbacks and partially executed locally.
This enables wrappers-based FDWs to delegate complete query execution, including joins, aggregates, projections, filters, ordering, limits, and parameters, while PostgreSQL only receives the final result rows.