I'm using DBIx::Class
in a web context and I'd like to display the number of SQL queries performed and the time they took for the rendering of a page.
Any idea about how to implement that?
I'm using DBIx::Class
in a web context and I'd like to display the number of SQL queries performed and the time they took for the rendering of a page.
Any idea about how to implement that?
See the DBIx::Class cookbook on the "Profiling" section for examples on how to do that.
Simply enabling profiling via the DBIC_TRACE=1
environment variable will not do what you want, but you can sub-class DBIx::Class::Storage::Statistics
(as per the linked cookbook example) and override query_start
and query_end
in a way that lets you count the SQL queries done.
The linked example is very close to what you want to achieve.