0

I have a regular case where I run many Postgres queries within a do/begin/end block

DO $$
BEGIN
<queries>
END $$;

In some cases, the databases and queries run a little bit slow and we need visibility to estimate how long the transaction will take and see any problems along the way.

Does there exist a build in postgres way to see which individual query within the transaction is being executed?

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Apr 14, 2023 at 4:40

1 Answer 1

0

The only thing that comes to my mind is to run something like this before each query:

RAISE NOTICE 'Now executing query number 42';

Such messages are reported to the client immediately.

1
  • This is a perfect solution for our case. Thank you
    – Hendy
    Commented Apr 18, 2023 at 3:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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