Re: Query gone wild

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Query gone wild
Дата
Msg-id 28373.1043867516@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Query gone wild  (Neil Conway <neilc@samurai.com>)
Ответы Re: Query gone wild  (Garo Hussenjian <garo@xapnet.com>)
Список pgsql-general
Neil Conway <neilc@samurai.com> writes:
> On Wed, 2003-01-29 at 12:58, Garo Hussenjian wrote:
>> Is there any way to view the query
>> that is being run from knowing a process id?

> You can use the pg_stat_activity view in PostgreSQL 7.2 and later -- see

However, he probably doesn't have stats_command_string turned on, or
he'd already be aware of pg_stat_activity :-(.  So this isn't much help
if the problem is to determine what an already-running query is.

Another possibility is to attach to the runaway process with a debugger
and print debug_query_string.  For example, with gdb:

    $ gdb /path/to/postgres-executable
    gdb> attach PID-OF-PROCESS
    gdb> p debug_query_string
    gdb> quit

This should work unless you are running a stripped backend executable.
(On many systems, the "file" command can tell you whether an executable
has been stripped of debug symbols.)

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Carmack
Дата:
Сообщение: Re: [NOVICE] Perl - Postgres
Следующее
От: greg@turnstep.com
Дата:
Сообщение: Re: Website troubles