1

The information in pg_stat_activity is sort of scarce, and does not give progress information for long queries.

This information is sort of available in v$session_longops in Oracle, which gives which object is being processed (target), the number of items it needs to go through (totalwork), and the number of item done so far (sofar). One can then use that to infer what part of the execution plan the engine is in. This information is available in Spark and Flink as well.

I was wondering if there was a way to have access to that in Postgres, either in system tables, or by observing the processes, or where one might look in the internals if he wants to implement a patch.

Cheers!

BenoitParis
  • 3,166
  • 4
  • 29
  • 56

1 Answers1

0

AFAIK there is no existing feature to monitor long running queries in detail (there is such a feature only for 3 DDL statements).

A patch has been proposed 3 years ago. It looks like it was not integrated.

See discussion in hackers mailing list: https://www.postgresql.org/message-id/CADdR5nxQUSh5kCm9MKmNga8+c1JLxLHDzLhAyXpfo9-Wmc6s5g@mail.gmail.com

pifor
  • 7,419
  • 2
  • 8
  • 16