How do we check the queries that were executed by user in PostgreSQL DB? I have a use case where some applications (AWS EMR, Python Scripts) execute queries on a daily basis on PostgreSQL DB. It would be helpful if I can see/log the last executed queries in case of any failures. I tried checking with pg_stat_activity
table, but it lists down the queries that are executed by the DB Server internally. Any pointers on this problem would be helpful.
In AWS Redshift we achieve this through tables STV_RECENTS, STL_QUERY. I am looking for a similar feature/solution, also open to any other approach to implement this.