Pg_stat_monitor 2.2 - Collapsing similar queries

Why doesn’t pg_stat_monitor 2.2 collapse such similar queries? Under high TPS, all buckets get filled with identical queries. As a result, it starts consuming more shared memory. It can collapse similar queries. In pg_stat_monitor, during just a few seconds of testing, there are 47,000 rows, with a limit of 20 buckets and pgsm_max of 192MB.

Is there a way to collapse similar queries? Which parameter in pg_stat_monitor is needed for this? I couldn’t find it in the documentation.

Hi @ANDiv1976 , it seems that there is some difference between these queries. Could you please check queryid, planid, userid, dbid, toplevel, and top_queryidfields in pg_stat_monitor view for this queries ? Which of them hold different values?

Hi @artem_gavrilov I hope the screenshot has all the necessary information.

I think you was hit by this bug: Jira

Try to disable pg_stat_monitor.pgsm_enable_query_plan = off

Looking forward to the bug fix. Thanks!

1 Like