0

In SQL Server when we have applications for which we do not have source code we could use the SQL Server profiler to analyze which queries or procedures are called when we do something in the application. Now I have similar situation with a .NET third party library and a Postgres database when it would be very useful to track queries called by that library. I found something similar in pgAdmin, but so far it appears to be useful to track only SQL queries that are executed in pgAdmin, not queries from external applications.

So to sum up: Is there a tool that allows me to track queries executed on a Postgres database from external applications?

EDIT: I tried to select from pg_stat_activity, but when I expect to see which stored procedures or statement is executed it prints only "COMMIT" string in the "query" column.

  • pg_stat_activity only shows the most recent statement that was executed, it does not show the history of all statements – a_horse_with_no_name Apr 23 at 13:45
0

Set log_statement = 'all' in postgresql.conf and reload PostgreSQL. Then all SQL statements will be written to the log.

| 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.