Issues

Select view

Select search mode

 
43 of 43

When using a non-default pg_stat_statements.max value, the calculated QPS displayed in QAN may be wrong.

Description

If pg_stat_statements.max is changed, the current PMM client-side cache for queries may not be enough for the query churn, and the results of calculating the per-minute query call deltas may be wrong.

From ClickHouse pmm.metrics table, for the problematic query, we see num_queries in the millions per minute, which is wrong. After 00:46, pg_stat_statements.max was changed from 20000 back to its default of 5000:

This can be easily reproduced by increasing pg_stat_statements.max:

and having a workload that generates unique queries, like:

Check statements stored:

And run an intensive workload for a SELECT count query in another session. If you let that query call reach the millions, it will be much more visible.

I’m attaching two screenshots showing the good and bad examples from QAN itself.

 

Suggested implementation:

  • Set cache size by the value from pg_stat_statements.max

  • Check if it affects pg_stat_monitor, perfschema

How to test

STR as above

Test simplification - Set pg_stat_statements.max to 10 000 and check for QPS

How to document

None

AFFECTED CS IDs

CS0052098

Attachments

2

Smart Checklist

hide

Details

Assignee

Reporter

Priority

Components

Needs QA

Yes

Needs Doc

Yes

Planned Version/s

Fix versions

Story Points

Affects versions

Smart Checklist Progress

Smart Checklist

Created January 23, 2025 at 1:34 AM
Updated 4 days ago

Activity

Show:
Loading...