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?

asked Apr 14, 2023 at 4:08
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. 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.

answered Apr 14, 2023 at 6:06
1
  • This is a perfect solution for our case. Thank you Commented Apr 18, 2023 at 3:38

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.