Alex Howansky <alex@wankwood.com> writes:
> Is there any way to determine exactly what a postgres process is
> doing at any time? The output from the ps command only shows "INSERT" or
> "SELECT", and not the full query string.
There isn't any really nice solution at the moment, but you could run
the postmaster with -d2 to cause writing of all queries to the
postmaster's log file (ie, its stdout/stderr). You'd probably also want
to compile with ELOG_TIMESTAMPS defined (see include/config.h) to get
timestamps and process PIDs included in the log. That'd give you info
to correlate against what "top" shows.
regards, tom lane