Skip to content

Conversation

RoystonS
Copy link

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:

image

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:
image

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:
image

A problematic query not able to be distributed:
image
(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:
image

@Copilot Copilot AI review requested due to automatic review settings October 18, 2025 18:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances PgAdmin's query plan visualization to properly display Citus distributed query plans instead of showing them as generic "Custom Scan" nodes. The changes parse Citus-specific query plan structures and convert them into a format that PgAdmin can render with detailed information about distributed operations.

  • Adds parsing logic to handle Citus distributed query plans with Jobs and Tasks
  • Implements custom image mapping for Citus-specific node types
  • Provides detailed visualization of worker nodes and shard distribution

Reviewed Changes

Copilot reviewed 2 out of 6 changed files in this pull request and generated 3 comments.

File Description
web/pgadmin/static/js/Explain/index.jsx Adds parsing logic to convert Citus distributed query structures into standard plan format
web/pgadmin/static/js/Explain/ImageMapper.js Implements custom image mapping and text formatting for Citus node types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@RoystonS RoystonS force-pushed the pr/add-citus-plan-support branch from 40db431 to 58b7180 Compare October 18, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant