Search Postgresql Archives

Re: How to get cursor query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/18/2015 06:44 AM, Tom Lane wrote:
Adrian Klaver <adrian.klaver@xxxxxxxxxxx> 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.

Well at some point the query will leave the view, but by default pg_stat_statements tracks the last 5000 distinct statements, so you have some time > 0 to find it.


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



--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux