Re: Log Unique Queries without Params? - Mailing list pgsql-general

From Julien Rouhaud
Subject Re: Log Unique Queries without Params?
Date
Msg-id CAOBaU_ZUQs30L2L2XUbwd2=1qbR=YpwrMF1aHXop5Jb5vYfz7A@mail.gmail.com
Whole thread Raw
In response to Log Unique Queries without Params?  (Chris Morris <chris@mysteryscience.com>)
Responses Re: Log Unique Queries without Params?
List pgsql-general
On Sun, Apr 12, 2020 at 6:51 AM Chris Morris <chris@mysteryscience.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
specificparameter 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
forwardedto 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.



pgsql-general by date:

Previous
From: Chris Morris
Date:
Subject: Log Unique Queries without Params?
Next
From: Michael Paquier
Date:
Subject: Re: Using of --data-checksums