pg_stat_monitor icon indicating copy to clipboard operation
pg_stat_monitor copied to clipboard

PG-592: Treat queries with different parent queries as separate entries

Open dutow opened this issue 2 years ago • 1 comments

  1. Previously pg_stat_monitor had a topquery and topqueryid field, but it was only a sample: it showed one of the top queries executing the specific query.

With this change, the same entry executed by two different functions will result in two entries in the statistics table.

  1. This also fixes a bug where the content of these field disappeared for every second query executed: previously the update function changed topqueryid to 0 if it was non zero, and changed it to the proper id when it was 0. This resulted in an alternating behavior, where for every second executed query the top query disappeared.

After these changes, the top query is always shown.

  1. The previous implementation also leaked dsa memory used to store the parent queries. This is now also fixed.

dutow avatar Jun 29 '23 06:06 dutow

CLA assistant check
All committers have signed the CLA.

it-percona-cla avatar Jun 29 '23 06:06 it-percona-cla

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Project coverage is 84.87%. Comparing base (d7999f1) to head (bf208ea).

Files Patch % Lines
pg_stat_monitor.c 84.61% 0 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #403      +/-   ##
==========================================
- Coverage   84.99%   84.87%   -0.12%     
==========================================
  Files           3        3              
  Lines        1293     1296       +3     
  Branches      197      198       +1     
==========================================
+ Hits         1099     1100       +1     
  Misses         98       98              
- Partials       96       98       +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jul 16 '24 14:07 codecov[bot]