Duration of recording, but not approval - postgresql. Are there any specific requests for this behavior?

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 registers the statement as well as the duration. If I give a request to connect to another database

 \c <database_name> 

it records neither duration nor operator. I thought this might not be a duration and operator log for meta commands that start with a backslash. But for some of them, it writes the operator and duration, for example \dt \l .

I think there may be a list of queries / commands for which a log will be created or not. is there such a list?

Having said that, the original question that made me dig it -

My application (golang-react application) interacts with the postgresql and logs operator and its duration. But after that he registers two more durations, the statement of which is not printed. (I commented on log_min_duration_statement ), so I'm not sure what requests are for this duration. Also, if I do a SELECT query,xact_start,query_start FROM pg_stat_activity; at that time, to see running requests, it does not display any other requests, except for those that I see in the logs.

How do I know for which requests this duration is?

+1
source share
1 answer

But after that he registers two more durations, the statement of which is not printed.

This is probably the duration of parsing, binding, and execution for the three steps of executing the instruction, if you have log_duration = on . It runs in only three steps through client applications - psql runs in a single pass.

If you just need the total, use log_min_duration_statement = 0 instead.

Yes, that is embarrassing. It might be worth recording it and presenting it as a report on the usability problem for pgsql-general.

+2
source

Source: https://habr.com/ru/post/1385087/


All Articles