Re: Log Unique Queries without Params?

From: Rene Romero Benavides <rene(dot)romero(dot)b(at)gmail(dot)com>
To: Chris Morris <chris(at)mysteryscience(dot)com>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Log Unique Queries without Params?
Date: 2020-04-13 06:20:29
Message-ID: CANaGW0_7BFhdhQu_vduf+PHg7wxNjgB5V_K6-dTKn6aRxO5+Xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Also try pg_stat_statements, does that on the fly and it will give you very
interesting execution stats too.

On Mon, Apr 13, 2020 at 12:37 AM Chris Morris <chris(at)mysteryscience(dot)com>
wrote:

> Thx!
>
> On Sat, Apr 11, 2020 at 11:55 PM Julien Rouhaud <rjuju123(at)gmail(dot)com>
> wrote:
>
>> On Sun, Apr 12, 2020 at 6:51 AM Chris Morris <chris(at)mysteryscience(dot)com>
>> wrote:
>> >
>> > I have a local script I've written that will scan a log of PG queries
>> to extract out unique queries without any specific parameter data. For
>> example, if these 2 queries are actually run:
>> >
>> > SELECT * FROM foo where bar = 1;
>> > SELECT * FROM foo where bar = 2;
>> >
>> > It will capture only:
>> >
>> > SELECT * FROM foo whee bar = :id;
>> >
>> > Are there any existing tools that do this already for me? I'm
>> considering setting up a server that can have logs forwarded to it and only
>> logging unique queries like this, but I don't want to build anything that
>> may already exist out there.
>>
>> pgbadger (http://pgbadger.darold.net/#about) will do that and much
>> more. Depending on what you want to achieve maybe pg_stat_statements
>> (https://www.postgresql.org/docs/current/pgstatstatements.html) is
>> also an alternative.
>>
>

--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message brajmohan saxena 2020-04-13 10:30:27 MPP feature in PG
Previous Message Chris Morris 2020-04-13 05:37:09 Re: Log Unique Queries without Params?