I want to log the whole function runtime for a single particular function in PostgreSQL? Is this possible?
The value of log_min_duration_statement = 3000 in postgresql.conf and I've tried to do:
ALTER FUNCTION mychema.myfunc(json) SET log_min_duration_statement = 100
, however I don't see any logs in /var/log/postgresql/postgresql-9.x-main.log
If the the log_min_duration_statement of the function is less than the log_min_duration_statement in the postgresql.conf does the function runtime get logged?
Can I add an exception somewhere to tell PostgreSQL that I want my function to get logged regardless if the global log_min_duration_statement value is < the log_min_duration_statement of the function?
I want the log_min_duration_statement of the function to take precedence over the global config value to see logs for that one function I'm interested in, not all the others, because enabling logging for all requests adds a significant overhead.
clock_timestamp()
both on entry and exit andRAISE LOG
with that information (or the difference or whatever).