Table/log file name which store the queries which got executed in last 1 month

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Table/log file name which store the queries which got executed in last 1 month

Gaurav Tomar
Hi All,

In our production environment data in some of the table has been updated from the back end by some user. The update is very random, is there any table which stores the details of queries got executed in last one month or so.

Regards,

Gaurav

+91 876 265 4621

lup
Reply | Threaded
Open this post in threaded view
|

Re: Table/log file name which store the queries which got executed in last 1 month

lup


On Apr 30, 2020, at 9:19 PM, Gaurav Tomar <[hidden email]> wrote:

Hi All,

In our production environment data in some of the table has been updated from the back end by some user. The update is very random, is there any table which stores the details of queries got executed in last one month or so.

Regards,

Gaurav

+91 876 265 4621

No.
Depending on the system configurations settings such as ‘log_statement there may be useful information in the postgres server logs.
Current version of these settings are described here: https://www.postgresql.org/docs/12/runtime-config-logging.html
Reply | Threaded
Open this post in threaded view
|

Re: Table/log file name which store the queries which got executed in last 1 month

ichbinrene
In reply to this post by Gaurav Tomar
Another option is making use of this trigger in such table https://wiki.postgresql.org/wiki/Audit_trigger , but I would go with logging if the table is very transactional, as suggested by Rob Sargent.  




On Thu, Apr 30, 2020 at 10:20 PM Gaurav Tomar <[hidden email]> wrote:
Hi All,

In our production environment data in some of the table has been updated from the back end by some user. The update is very random, is there any table which stores the details of queries got executed in last one month or so.

Regards,

Gaurav

+91 876 265 4621



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

Reply | Threaded
Open this post in threaded view
|

Re: Table/log file name which store the queries which got executed in last 1 month

legrand legrand
If thoses users are connected with distinct accounts from application into
the database, maybe that pg_stat_statements may help see
https://www.postgresql.org/docs/current/pgstatstatements.html

Regards
PAscal




--
Sent from: https://www.postgresql-archive.org/PostgreSQL-sql-f2142323.html


Reply | Threaded
Open this post in threaded view
|

Re: Table/log file name which store the queries which got executed in last 1 month

Craig Jackson
Going forward you might consider enabling  the parameter 

track_commit_timestamp

This would allow you to view the latest transaction commit times for rows in a table, but be aware that there will be some performance overhead by enabling this. 

Regards,

Craig

On Fri, May 1, 2020 at 1:55 AM legrand legrand <[hidden email]> wrote:
If thoses users are connected with distinct accounts from application into
the database, maybe that pg_stat_statements may help see
https://www.postgresql.org/docs/current/pgstatstatements.html

Regards
PAscal




--
Sent from: https://www.postgresql-archive.org/PostgreSQL-sql-f2142323.html




--
Craig