0

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?

a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843
Ricky
  • 2,457
  • 4
  • 23
  • 51

1 Answers1

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.

a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843