I have a long running PL/pgSQL stored procedure in PostgreSQL. How can I determine the currently executing statement in it?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
One crude but effective method, available in any version, is to raise notices in your plpgsql function:
Another possibility would be to use auto-explain with
The second method gives you a lot more than you asked for. Both are crutches and work-arounds and more or less intrusive.
It's already documented in the /devel manual.