Re: How to get cursor query

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

On 08/18/2015 07:11 AM, Tom Lane wrote:
> Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
>> On 08/18/2015 06:44 AM, Tom Lane wrote:
>>> Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
>>>> 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.
>
> No, you don't have any time to find it, because pg_stat_statements can
> only track operations in backends that it's already been loaded into.

I was not clear enough. The intent was for the OP to load
pg_stat_statements into the remote server and just leave it running. At
that point you have something that replicates(to a degree) log_statement
= 'all' in postgresql.conf without having to remember to turn it on or
off. It imposes an overhead, but that is the case for anything that
tracks history. It up to the user to decide whether the benefit is worth
the cost.

> What's more, it requires shared memory that can only be allocated at
> postmaster start, so that there's really no way to load it without a
> postmaster restart.
>
> regards, tom lane
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael H 2015-08-18 15:01:01 CentOS - PostgreSQL 9.2.13 -> 9.4
Previous Message Tom Lane 2015-08-18 14:11:27 Re: How to get cursor query