Ms workaholic
Ms workaholic

Reputation: 393

Is there any way to trace and debug a query in Postgresql?

Is there any way/tool to trace and debug a query in PostgreSQL 9.3.18? I'm a SQL programmer and sometimes I need to trace and debug my queries and see the values of different fields at execution time. I've Googled this but didn't get any relevant result.

Any idea would be appreciated

Upvotes: 1

Views: 7998

Answers (1)

PG Admin (database interaction GUI) that is sometimes bundled with PostgreSQL includes a step through debugger for query/calls to Postgres database functions (as opposed to every query that goes to the server). https://www.pgadmin.org/docs/pgadmin4/4.29/debugger.html Before using it you have to enable it as a plugin/library in PG Admin.

The debugger will step to statements so sometimes a complex single statement will execute without letting you step through it's details. Still, if you need to see a basic step through of a longer multi statement function or variable values at some points it can be useful. Note, this debug applies to database functions and not general queries.

Upvotes: 2

Related Questions