I am running an application in a particular server which updates a postgres database table.Is there any way that I can retrieve all the queries executed to that database (may be my table) from a -period of time if I have admin privilege?
Asked
Active
Viewed 23 times
0
-
Have a look here: https://stackoverflow.com/questions/722221/how-to-log-postgresql-queries – StephaneM Oct 24 '17 at 06:48
1 Answers
1
You can install the extension pg_stat_statements which will give you a summary of the queries executed.
Note that the number of queries that are stored in the table pg_stat_statements
is limited (the limit can be configured). So you probably want to store a snapshot of that table on a regular basis. How often depends on your workload. Increasing pg_stat_statements.max
means you can reduce the frequency of taking snapshots from that table.