Re: How to get cursor query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Mikhail <bemewe(at)mail(dot)ru>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to get cursor query
Date: 2015-08-18 13:44:28
Message-ID: 7575.1439905468@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
> On 08/18/2015 01:43 AM, Mikhail wrote:
>> 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
>> ...
>> Is it possible to get query text corresponding to cursor c514?

> The only thing I can think to do is load pg_stat_statements:
> http://www.postgresql.org/docs/9.4/interactive/pgstatstatements.html

That won't help after-the-fact either.

If you're using postgres_fdw then the set of queries it could issue via a
cursor is pretty restricted --- just SELECT-from-single-table AFAIR ---
and you could tell which table by looking at the locks held by the cursor
transaction (see pg_locks on the remote server). Perhaps that's close
enough?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2015-08-18 14:05:38 Re: How to get cursor query
Previous Message Joseph Kregloh 2015-08-18 13:33:20 Re: How to tune my new server