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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
See the DBIx::Class cookbook on the “Profiling” section for examples on how to do that.
Simply enabling profiling via the
DBIC_TRACE=1environment variable will not do what you want, but you can sub-classDBIx::Class::Storage::Statistics(as per the linked cookbook example) and overridequery_startandquery_endin a way that lets you count the SQL queries done.The linked example is very close to what you want to achieve.