lessql icon indicating copy to clipboard operation
lessql copied to clipboard

Is it possible to get execution time of each queries

Open ddurieux opened this issue 9 years ago • 3 comments
trafficstars

I log queries with setQueryCallback() nut we only have the queries, is it possible to get the query time execution?

perhaps in the $params argument?

ddurieux avatar Aug 18 '16 21:08 ddurieux

Hm no, you can always wrap with your own timing functions to measure execution time of method calls on LessQL objects

morris avatar Aug 27 '16 09:08 morris

To do this, one would:

  1. Add queryEndCallback in a subclass of LessQL\Database.
  2. Find usages of onQuery in LessQL\Database.
  3. Overrule those methods in the subclass.

https://gist.github.com/rubenvincenten/ef8aaa32a0e413592c8df74ba7ae910e

This should really be implemented in the v0 branch however, tagging it like v0.4? I'm assuming the next branch will be 1.x. I'll see about creating a pull request.

An alternative would be to use a subclass of PDO, like http://www.coderholic.com/php-database-query-logging-with-pdo/ Also, I found https://github.com/panique/pdo-debug to be an invaluable tool.

Langmans avatar Sep 23 '16 07:09 Langmans

Something like the debug panel of Zebra Database would be amazing!

SirTimmyTimbit avatar Nov 01 '16 19:11 SirTimmyTimbit