Is it possible to get a history of queries made in postgres

前端 未结 7 1968
借酒劲吻你
借酒劲吻你 2021-01-30 03:41

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

7条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 04:23

    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=# 
    

提交回复
热议问题