Pages

05 January, 2024

Get parameters for currently running queries in PostgreSQL

We wrote a small tool which displays all currently running queries. We get the currently running queries from pg_stat_activity.



The problem is: We dont know the parameters which were given to the query. We can only see the placeholders $1, $2, etc.



Is there any way to get the parameters for a currently running query?



The only workaround could be to enable the query log and parse the parameters from the query log, but this would be a very dirty and slow solution.

No comments:

Post a Comment

Thanks