Skip to content

Add the type of statement (SELECT|INSERT|UPDATE|DELETE) as a label in the stat_statements collector #946

Open
@przemek-pokrywka

Description

@przemek-pokrywka

Proposal

Use case. Why is this important?

My database enjoys/suffers heavy read+write traffic with the writes dominating the load, sometimes by orders of magnitude. That makes it very difficult to track the performance of the read queries, even when one uses a logarithmic scale on Grafana. The read (SELECT) queries are simply very close to the bottom and only if you manually hide many write (INSERT) queries, the dashboard becomes usable.

If postgres_exporter would add yet another label to the metrics exported from the pg_stat_statements view, it would be much easier to filter out the write queries. The label would need to contain the type of statement: INSERT/UPDATE/DELETE/CREATE/ALTER/SELECT/OTHER.

Even if postgres_exporter did something really simple (like taking the first word from the query column, without really parsing the SQL) it would help a lot already.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions