Show details Citus query plan instead of just 'Custom Scan' #9265
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.
PR is for issue #7885
With Citus installed into Postgres, query plans are augmented to add details of how queries are distributed across shards and worker nodes. But PgAdmin shows these query plans as a single 'Custom Scan ?' query node, hiding all of the plan details:
This PR takes the Citus-enhanced query plans and converts them into a simpler Plan-with-sub-Plans structure that PgAdmin already knows how to render.
The display is largely as demonstrated in PR #7885, but I've tidied it up and added some new icons to represent the various stages better.
Some examples:
A query distributed across 32 nodes, with all 32 tasks appearing in the query plan:

A query distributed across 2 nodes, with only one of the 2 tasks appearing in the query plan, and the Citus distribution appearing in the middle of the overall plan, with aggregation/sorting happening after the Citus distribution:

A problematic query not able to be distributed:

(The text comes directly from the query plan itself, so can't easily be localised in PgAdmin.)
Citus also supports schema-based sharding. This is an example query using that shading scheme:
