Skip to content

Add optional no-query-text pg_stat_statements collectors - #490

Open
maltere wants to merge 1 commit into
CrunchyData:developmentfrom
maltere:add-pg-stat-statements-no-query-text
Open

maltere wants to merge 1 commit into
CrunchyData:developmentfrom
maltere:add-pg-stat-statements-no-query-text

Conversation

@maltere

@maltere maltere commented Sep 18, 2026

Copy link
Copy Markdown

Description

This adds optional postgres_exporter collector files that retrieve pg_stat_statements metrics without loading retained query text.

PostgreSQL loads its complete query-text storage before evaluating expressions such as left(s.query, 40). Large retained statements can therefore make the existing collectors expensive and cause scrape timeouts.

The new collectors:

  • use public.pg_stat_statements(false);
  • preserve existing metric names and labels;
  • emit an empty query label;
  • continue exporting queryid, role, database, timing, row and WAL metrics.

Existing collectors remain unchanged, preserving current dashboard behavior. Documentation explains how to select the no-query-text variant and its observability trade-off.

  • Bugfix
  • Enhancement
  • Breaking Change
  • Documentation

closes #489

Testing

  • Installation method:
    • Other: source-tree collector validation
  • PostgreSQL: 13, 14, 15, 16 and 17
  • Hugo 0.166

Code testing

  • Executed all five rendered collector queries against PostgreSQL 13–17.
  • Verified pg_stat_statements(false) returns statistics without query text using retained large utility statements.
  • Confirmed collector names and metric schemas match the existing collectors.
  • Parsed all collector and changelog files as YAML.
  • Built the documentation successfully.
  • Ran the changed-file pre-commit suite.

Checklist

  • Documentation updated
  • Release notes updated
  • Upgrade documentation not required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pg_stat_statements collectors should support disabling query-text retrieval

1 participant