Skip to content

Fix stats#1561

Merged
oppenheimer01 merged 5 commits intoapache:cbdb-postgres-mergefrom
lss602726449:fix_stats
Feb 4, 2026
Merged

Fix stats#1561
oppenheimer01 merged 5 commits intoapache:cbdb-postgres-mergefrom
lss602726449:fix_stats

Conversation

@lss602726449
Copy link
Contributor

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


huansong and others added 5 commits February 3, 2026 17:47
For a selected list of PG system views (started with 'pg_'prefix ), we
will create a corresponding 'gp_' view for each one in the list.
Each 'gp_' view is basically a UNION ALL of the results of running the
corresponding 'pg_' view on all segments (including the coordinator).

Note that, these views do not aggregate the results. The aggregate
version of the views will be named with a '_summary' appendix (such
as 'gp_stat_all_tables_summary').

To add a new 'pg_' view to this list, simply put the name in file
'src/backend/catalog/system_views_gp.in'. This commit adds an initial
list of views that we think make sense to have 'gp_' views.

With this change, we also remove the existing definition of
gp_stat_archiver view and let it be generated automatically.
We also had gp_stat_replication but it carries additional column than
pg_stat_replication so it cannot use the automatic way.
Added the following views:

gp_stat_progress_vacuum_summary
gp_stat_progress_analyze_summary
gp_stat_progress_cluster_summary
gp_stat_progress_create_index_summary

Also replaced pg_stat_progress_* views with gp_stat_progress_* views for
existing tests.
These summary views offer basic aggregation of the gp_stat_* views across Greenplum coordinator and
segments.

Aggregation logic applied as follows:
* Time related (last_%): use max()
* Transaction related, not innately summable (number of commits/rollbacks) : use max()
* Table specific: sum()/numsegments for replicated tables, sum() for
  distributed tables
* Innately summable stats, if no particular table is involved: use sum()
* pid: use coordinator's pid (not used here, but this is the convention in other gp_%_summary views)
@oppenheimer01 oppenheimer01 merged commit 09102ae into apache:cbdb-postgres-merge Feb 4, 2026
3 checks passed
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.

5 participants