5

What is query can I use for show last executed queries in DB PostgreSQL or where (files) can I find this? I use pgADMIN 3

2
  • Probably related: stackoverflow.com/questions/8208310/… Commented Sep 21, 2017 at 15:55
  • 1
    Use pg_stat_statements. Or set log_statement = all and use the log file. Commented Sep 21, 2017 at 15:57

2 Answers 2

7

For those on the command line using psql, you can view the command history with

\s

Or print it to a file with

\s filename

See also

Sign up to request clarification or add additional context in comments.

1 Comment

Also: the history of issued psql commands is often found in .psql_history file in the home directory. (Nice link :)
1

See the History tab in the output pane.

You can find or change the location of the file under the File/Options... dialog.

4 Comments

rd_nielsen I want to know all queries (include from remoute pcs) not only me from pgAdmin
As far as I know, there's no way to do that. The best approach may be to establish a discipline wherein all SQL commands are scripted, and scripts are run with a custom script executor that records the time that each statement is executed in a common logfile.
@rd_nielsen er... log_statement = 'all', or use pg_stat_statements
@CraigRinger: Ah, of course -- that's the way to do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.