Skip to content

gp_stats_collector: opt-in EXPLAIN (FORMAT JSON) plans, extension 1.2 - #424

Open
Sanikadze wants to merge 12 commits into
open-gpdb:OPENGPDB_STABLEfrom
Sanikadze:feat/gpsc-format-json
Open

gp_stats_collector: opt-in EXPLAIN (FORMAT JSON) plans, extension 1.2#424
Sanikadze wants to merge 12 commits into
open-gpdb:OPENGPDB_STABLEfrom
Sanikadze:feat/gpsc-format-json

Conversation

@Sanikadze

Copy link
Copy Markdown

Problem

Consumers that draw the plan as a tree (yagpcc's Grafana panel via PEV2) need it as data. The text plan does not parse reliably: structure is in indentation, Greenplum adds its own annotations (Gather Motion 2:1 (slice1; segments: 2), Rows out: ..., ORCA cost lines), and PEV2 fromText drops Motion nodes. EXPLAIN (FORMAT JSON) comes from the same tree walk and is stable across minor versions.

Text plans are unchanged and always collected. plan_id is still the hash of the normalized text plan.

Extension 1.1 -> 1.2

gpsc.__log is built positionally from log_tbl_desc, so the layout changes.

  • gp_stats_collector--1.1--1.2.sql: ALTER TABLE ... ADD COLUMN x2, gpsc.log view recreated.
  • Fresh 1.2 and upgraded 1.1 tables have the same layout. utility is looked up by name, not assumed last.
  • A 1.2 .so on a 1.1 table does not write misaligned rows: insert_log checks the attribute count, warns once per backend with a HINT to run ALTER EXTENSION gp_stats_collector UPDATE, and skips table logging until then. UDS logging is unaffected.
  • Install .so, extension/*.sql and .control on all hosts (ALTER EXTENSION is dispatched to segments). New .so needs a restart.

Compatibility

  • Default off: existing installations get only the GUC and the 1.2 files.
  • Older agent keeps 15/16 as unknown protobuf fields and ignores them.
  • JSON payload is 3-5x the text plan, hence opt-in.

@Sanikadze Sanikadze changed the title Feat/gpsc format json gp_stats_collector: opt-in EXPLAIN (FORMAT JSON) plans, extension 1.2 Sep 12, 2026
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