[Question posted by a user on YugabyteDB Community Slack]
Testing adding sql long query logging but it appears prepare statement executions are not following the min_duration
gflags. The output in the postgres log also is not showing the duration which might be part of the issue? Or I am just misunderstanding the documentation? Version 2.8.0.0b37. 5 tservers/3 masters in universe. tserver flags used in tserver startup:
--ysql_log_min_duration_statement=60000
--ysql_log_statement=all
The log:
2022-03-04 16:28:53.595 UTC [1548953] LOG: execute lrupsc_349_3:
UPDATE table SET
f1 = $1,
f2 = $2,
f3 = $3
WHERE
f4 = $4
2022-03-04 16:28:53.595 UTC [1548953] DETAIL: parameters: $1 = 'Running', $2 = 'worker-0', $3 = '2022-03-04 16:28:53.597931+00', $4 = 'c8h3shbp695ddkmko6e0'
f4 is table pk
I’m looking to ONLY show ysql statements that exceed the log_min_duration_statement
duration.
I would suggest to set only the
log_min_duration_statement
to desired value. That should be sufficient for the use case.Postgres logs –
ysql_log_statement
andysql_log_min_duration_statement
are independent flags. The only dependency being if statement is logged byysql_log_statement
already, then won’t be repeated again even if it qualifies based onysql_log_min_duration_statement
.