I have the following setting in my postgresql.conf
log_statement='all'
log_duration=on
When I run psql, and run any query like select/create user/ etc, it logs the statement as well as the duration. If I give the query to connect to a different database
c <database_name>
it logs neither the duration nor the statement. I thought it might not log duration and statement for meta-commands that starts with a backslash. But it does log the statement and duration for some of them, like dt
l
.
I think there might be a list of queries/commands, for which log will be generated or not. is there any such list?
Having said that, the original issue, that led me to dig this is --
My application (golang-react application) interacts with postgresql and logs statement and its duration. But after that it logs two more durations, whose statement is not printed. (I have commented log_min_duration_statement
), so I'm not sure what queries, this duration is for.
Also if I do SELECT query,xact_start,query_start FROM pg_stat_activity;
at that time to see the running queries,it does not show any other query than the one which I see in the logs.
How can I know which queries is this duration for?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…