Is it possible to get a history of queries made in postgres? and is it be possible to get the time it took for each query? I\'m currently trying to identify slow queries in the
If The question is the see the history of queries executed in the Command line. Answer is
As per Postgresql 9.3
, Try \?
in your command line, you will find all possible commands, in that search for history,
\s [FILE] display history or save it to file
in your command line, try \s
. This will list the history of queries, you have executed in the current session. you can also save to the file, as shown below.
hms=# \s /tmp/save_queries.sql
Wrote history to file ".//tmp/save_queries.sql".
hms=#