Re: Checking what is the current query running

Поиск
Список
Период
Сортировка
От Markus Wollny
Тема Re: Checking what is the current query running
Дата
Msg-id 28011CD60FB1724DBA4442E38277F62601C95103@hermes.computec.de
обсуждение исходный текст
Ответ на Checking what is the current query running  ("Marco Bizzarri" <marco.bizzarri@gmail.com>)
Ответы Re: Checking what is the current query running  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
Hi,

pg_stat_activity has some limitations however; if you use a lot of
dynamically generated complex queries, you might stumble over the 255
character limit of current_query in pg_stat_activity, statement-strings
longer than that are just cut off.

You can get some more information if you need it, using the GNU debugger
gdb: First you need to determine the PID of the PostgreSQL backend
that's running your query - I usually use top for that, but
pg_stat_activity does also give you that info (select procpid from
pg_stat_activity ...). Once you have the PID, you start the GNU debugger
with

gdb [path_to_postgres] [pid]
e.g. gdb /opt/pgsql/bin/postgres 551

Now issue the command
    printf "%s\n", debug_query_string
to obtain the query string. To quit the debugger, just type "quit" and
confirm - the backend will keep processing the query uninterrupted.

Kind regards

   Markus



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

Предыдущее
От: "Shoaib Mir"
Дата:
Сообщение: Re: Checking what is the current query running
Следующее
От: adey
Дата:
Сообщение: Re: UTF8 characters