Skip to content

PG-2623 Utility statement normalization - #830

Merged
artemgavrilov merged 3 commits into
mainfrom
PG-2623-utility-statement-normalization
Aug 24, 2026
Merged

PG-2623 Utility statement normalization#830
artemgavrilov merged 3 commits into
mainfrom
PG-2623-utility-statement-normalization

Conversation

@artemgavrilov

@artemgavrilov artemgavrilov commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

PG-2623

Description

To have normalized query text for utility statements we have to pre-save it in post parse hook. (pretty much the same as for ordinary queries). Because some utility statements may cleanup our memory context we have to copy query stats entry to stack.

Links

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.41%. Comparing base (b2a0b05) to head (fe1c329).

Files with missing lines Patch % Lines
src/pg_stat_monitor.c 89.47% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #830      +/-   ##
==========================================
- Coverage   88.68%   88.41%   -0.27%     
==========================================
  Files           3        3              
  Lines        1317     1321       +4     
  Branches      186      193       +7     
==========================================
  Hits         1168     1168              
- Misses         75       77       +2     
- Partials       74       76       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@artemgavrilov
artemgavrilov force-pushed the PG-2623-utility-statement-normalization branch 2 times, most recently from bab1472 to 175c83b Compare August 19, 2026 13:46
@artemgavrilov
artemgavrilov marked this pull request as ready for review August 19, 2026 13:54
@artemgavrilov
artemgavrilov force-pushed the PG-2623-utility-statement-normalization branch from 175c83b to 3e478c6 Compare August 19, 2026 21:44
Comment thread src/pg_stat_monitor.c
Comment thread src/pg_stat_monitor.c Outdated
Comment thread src/pg_stat_monitor.c
Comment thread src/pg_stat_monitor.c
Comment thread src/pg_stat_monitor.c Outdated
@artemgavrilov
artemgavrilov force-pushed the PG-2623-utility-statement-normalization branch from 3e478c6 to 6dfd3ab Compare August 21, 2026 14:26
@artemgavrilov
artemgavrilov requested a review from jeltz August 21, 2026 15:05
Split pgsm_get_query_stats() into an explicit lookup and create entry functions.
Crete query stats entry for utility statements in pgsm_post_parse_analyze hook,
where we have normalized query text. Because utility statement execution
may tirgger memory context cleanup we have to copy entry found in the
list to the stack.

This change brings parity with pg_stat_statements regarding utitliy
statements.
After recent changes there is no more reasons to have two distinct
functions instead of one.
@artemgavrilov
artemgavrilov force-pushed the PG-2623-utility-statement-normalization branch from 6dfd3ab to fe1c329 Compare August 24, 2026 13:35
@artemgavrilov
artemgavrilov merged commit 9878d04 into main Aug 24, 2026
36 checks passed
@artemgavrilov
artemgavrilov deleted the PG-2623-utility-statement-normalization branch August 24, 2026 14:52
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.

2 participants