Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
przemek-pokrywka opened this issue Oct 30, 2023 · 1 comment

Comments

@przemek-pokrywka
Copy link

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.

@SuperQ
Copy link
Contributor

SuperQ commented Oct 30, 2023

Huh, PostgreSQL doesn't have this information in any other metrics source?

We're looking to add query as a label with a length limit.

There are two open PRs for this that need reviewing:

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

No branches or pull requests

2 participants