Inspecting size of results from Java JDBC


#1

Hi,

I have a use case where it would be helpful to provide some kind of middleware to clojure.java.jdbc which logs the size of returned results in kilobytes. As far as I can tell that is not really an option, but I’m writing here because I hope to be proven wrong. :slight_smile:

I have a server that looks like it is receiving a lot more data from the database than it sends on to the clients. To pinpoint the query or queries that request all that data, I would like to instrument every single clojure.java.jdbc call with a function that receives the entire result of the query, does some size computation on the result, and returns the result unmodified while logging the result size and query (or some other way of identifying to which query the result belongs). If you has anyone else had to do this, or have a good idea how to do it? I would really like to avoid instrumenting each query separately.

Thanks!