I am working with pg_stat_activity in postgres. It is working and I can see queries in this view after clicking the play button in datagrip. However, some queries I definitely executed (see screenshot, and look at the first query) are not shown at all. I need statistics of them (so really all my queries). How to ensure pg_stat_activity shows all my queries? Do I need to add additional settings?queries in datagrip


pg_stat_activity is not an auditing facility. It only shows one query per connected session. Either the query which is currently executing, or if the connection is idle than the immediately prior query.

If you want to see historical queries, use a different tool. Maybe pg_stat_statements, or log_statement=all. Or any of a large number of third-party tools.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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