From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Mikhail <bemewe(at)mail(dot)ru>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to get cursor query |
Date: | 2015-08-18 13:32:59 |
Message-ID: | 55D3340B.5030603@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 08/18/2015 01:43 AM, Mikhail wrote:
> Hi,
> I have a long executing query via foreign data wrapper and on the remote
> server i can see that the query is fetching data from the cursor
>
> =# select application_name, state, query from pg_stat_activity where pid
> = 15455;
> application_name │ state │ query
> ──────────────────┼────────┼─────────────────────
> postgres_fdw │ active │ FETCH 100 FROM c514
>
> Is it possible to get query text corresponding to cursor c514?
>
> One of the solution is to turn statement logging on (found it here
> http://www.postgresql.org/message-id/1361CEF686657C41A139AD8C3145632B44B33A8F@E2010-MB1.manord.com),
> but it works if i turn statement logging on before query execution. What
> can i do in case of connection to the server after the statement was
> executed?
The only thing I can think to do is load pg_stat_statements:
http://www.postgresql.org/docs/9.4/interactive/pgstatstatements.html
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Joseph Kregloh | 2015-08-18 13:33:20 | Re: How to tune my new server |
Previous Message | Jan Keirse | 2015-08-18 11:47:43 | Re: PostgreSQL conf parameter setting |