Retain statistics for each query request and thus simply per context and then log slow requests.
Number of queries of each type (SELECT/UPDATE/INSERT/...)
Number of rows returned
Number of bytes transferred.... (harder, would have to actively count for that)
Retain the query strings
Especially in the situation where nginx already has given up (and thus a HTTP Gateway timeout) is returned, we should log the details of this event (gateway disconnect, which can be detected with ErrIsDisconnect error, eg in page_render; also log it when a request takes more than X seconds.
We have to do this in lib/db.go as the Golang PostgreSQL driver does not do this for us.
PS: Might want to investigate options that postgresql provides inside the server
Retain statistics for each query request and thus simply per context and then log slow requests.
Especially in the situation where nginx already has given up (and thus a HTTP Gateway timeout) is returned, we should log the details of this event (gateway disconnect, which can be detected with ErrIsDisconnect error, eg in page_render; also log it when a request takes more than X seconds.
We have to do this in lib/db.go as the Golang PostgreSQL driver does not do this for us.
PS: Might want to investigate options that postgresql provides inside the server