1

Is there a way I can query through pgAdmin in a way I will get statistics for daily query usage?

I need to find what queries are run against my api as I get huge network traffic. I'm looking for a way I can get top queries for example (top 100). I've tried using various pg statistics, but didn't find anything that provides this feature.

1 Answer 1

2

The extension pg_stat_statements is what you are looking for. It is not provided by PgAdmin4, but you can use PgAdmin4 to read from the view it creates. It provides cumulative stats, so you either need to reset them every night, or just save daily snapshots and compute the differences. You might want to use PgAgent to automate some of this. (I have no experience with PgAgent, I just know that it exists. I use crontab to schedule things)

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.