Commit 7d69338
committed
fix: limit pg_stat_statements queryid cardinality to prevent VictoriaMetrics OOM
Add ORDER BY calls DESC LIMIT 100 to both pg_stat_statements metric SQL
variants (PG 11+ and PG 17+) so pgwatch only exports the top 100 most-called
queries. Previously ALL queryids were exported — on PostgREST databases this
meant ~7K new unique queryids per minute, creating 16M+ time series that
OOM-killed VictoriaMetrics (3.9GB/4GB).
Also add sample_limit: 5000 to the pgwatch scrape config as a safety net
to reject any scrape that produces more than 5000 samples.
Closes #143
Related to #130
https://claude.ai/code/session_01SzJxzZNQjDQphaHyaX3RU71 parent 2f3c31f commit 7d69338
2 files changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1035 | 1035 | | |
1036 | 1036 | | |
1037 | 1037 | | |
| 1038 | + | |
| 1039 | + | |
1038 | 1040 | | |
1039 | 1041 | | |
1040 | 1042 | | |
| |||
1081 | 1083 | | |
1082 | 1084 | | |
1083 | 1085 | | |
| 1086 | + | |
| 1087 | + | |
1084 | 1088 | | |
1085 | 1089 | | |
1086 | 1090 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
0 commit comments