Tools like the DbVisualizer typically display an exec/fetch time after executing a database query. Is it possible to access such performance metrics after executing a query through JDBC?
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
ResultSetMetaData rsmd = rs.getMetaData();
// missing functionality:
float executionTime = rsmd.getExecTime();
float fetchTime = rsmd.getFetchTime();
I did not find any such performance measure functionality in either the ResultSet
or ResultSetMetaData
classes. Is there no better way than 'manually' measuring the elapsed time using the system clock as discussed for example in How do I calculate the elapsed time of an event in java?