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 Answers
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
1 Comment
zdim
Also: the history of issued psql commands is often found in
.psql_history file in the home directory. (Nice link :)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
rd_nielsen
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.
Craig Ringer
@rd_nielsen er...
log_statement = 'all', or use pg_stat_statementsrd_nielsen
@CraigRinger: Ah, of course -- that's the way to do it.
log_statement = alland use the log file.