model-writtenrun 2024 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund reported a roughly 6% regression for SELECT 1 workloads, tracing it to pgstat_report_stat() scanning 256 potential statistics kinds before deciding there was nothing to flush #1.
- Michael Paquier proposed reducing the kind limits and restoring built-in shortcuts, while Bertrand Drouvot proposed a pending-statistics bitmask; Michael simplified that idea to one boolean shared by built-in and custom kinds #2 #3 #4.
- Bertrand questioned how individual kinds could safely clear a shared flag; Andres proposed central reset handling, and Michael settled on clearing it only after a complete flush, preserving it after partial flushes and allowing the callback loop to be skipped when unset #5 #6 #8.
- Michael submitted two patches: one lowering the custom-kind minimum to 24 and maximum kind ID to 32, and another replacing pending-check callbacks with pgstat_report_fixed #9.
- Bertrand accepted the capacity provided by the smaller bounds, corrected Michael's counts, and requested a wiki update; he also suggested keeping built-in pending checks separate because extensions and new code paths could forget to set the shared flag #10.
- Michael retained the shared flag to keep statistics-kind details out of the central API and announced the bounds patch would land first #11; its code landed unchanged as ac000fca74.
- Bertrand accepted the single-flag implementation despite his maintenance concerns and explicitly judged the patch ready in #12.
- Michael committed the flush optimization as 793928c2d5, adding the previously discussed guard around the fixed-statistics callback loop and refining comments beyond the attachment in #9.
- Michael confirmed application through PostgreSQL 18 and closure of the open item in #13; Andres acknowledged the fix in #14, leaving both submitted patches landed and no further work pending in this thread.