summaryrefslogtreecommitdiff
path: root/src/backend/executor/execAsync.c
diff options
context:
space:
mode:
authorMichael Paquier2025-07-27 23:15:11 +0000
committerMichael Paquier2025-07-27 23:15:11 +0000
commit793928c2d5ac8e60e1e4054fa3b986369777896d (patch)
tree9631e9f1dc2bd7616bb71938d947b650076f7521 /src/backend/executor/execAsync.c
parent258bf0a2ea8ff86257f750018bfd44397ce7e554 (diff)
Fix performance regression with flush of pending fixed-numbered statsHEADmaster
The callback added in fc415edf8ca8 used to check if there is any pending data to flush for fixed-numbered statistics, done by looping across all the builtin and custom stats kinds with a call to have_fixed_pending_cb, is proving to able to show in workloads that do not report any stats (read-only, no function calls, no WAL, no IO, etc). The code used in v17 was cheaper than that what HEAD has introduced, relying on three boolean checks for WAL, SLRU and IO stats. This commit switches the code to use a more efficient approach than fc415edf8ca8, with a single boolean flag that can be switched to "true" by any fixed-numbered stats kinds to force pgstat_report_stat() to go through one round of reports. The flag is reset by pgstat_report_stat() once a full round of reports is done. The flag being false means that fixed-numbered stats kinds saw no activity, and that there is no pending data to flush. ac000fca743e took one step in improving the performance by reducing the number of stats kinds that the backend can hold. This commit takes a more drastic step by bringing back the code efficiency to what it was before v18 with a cheap check at the beginning of pgstat_report_stat() for its fast-exit path. The callback have_static_pending_cb is removed as an effect of all that. Reported-by: Andres Freund <andres@anarazel.de> Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://postgr.es/m/eb224uegsga2hgq7dfq3ps5cduhpqej7ir2hjxzzozjthrekx5@dysei6buqthe Backpatch-through: 18
Diffstat (limited to 'src/backend/executor/execAsync.c')
0 files changed, 0 insertions, 0 deletions