I enabled in postgresql.conf this parameters:
log_statement = 'all'
logging_collector = on
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
log_directory = 'pg_log'
and now I see this:
2020-08-26 11:05:33.151 UTC [29051] postgres@mydb LOG: duration: 134.300 ms
2020-08-26 11:05:33.475 UTC [29050] postgres@mydb LOG: duration: 1015.984 ms
2020-08-26 11:05:33.601 UTC [29041] postgres@mydb LOG: duration: 1149.833 ms
2020-08-26 11:05:34.815 UTC [29053] postgres@mydb LOG: duration: 2354.413 ms
2020-08-26 11:05:39.963 UTC [29056] postgres@mydb LOG: duration: 7495.109 ms
2020-08-26 11:05:39.971 UTC [29054] postgres@mydb LOG: duration: 7506.584 ms
2020-08-26 11:05:39.976 UTC [29055] postgres@mydb LOG: duration: 7514.726 ms
2020-08-26 11:05:40.101 UTC [29058] postgres@mydb LOG: duration: 7629.628 ms
2020-08-26 11:05:40.450 UTC [29057] postgres@mydb LOG: duration: 7973.784 ms
2020-08-26 11:05:41.293 UTC [29059] postgres@mydb LOG: duration: 8820.805 ms
I want to know which query take so long time.
Postgresql 10 Ubuntu 18.04.2 LTS