Potentially slow SQL queries that are deeply buried in your application code can now be conveniently revealed by the DB profiling functions in Gyroscope 13.6.
The database wrapper, sql.php, detects the presence of a global $gsdbprofile array, if defined, the call time of each query is registered. The result can either be printed as-is, or rendered with the dumpgsdbprofile function, which is defined in forminput.php.
Here is an example scenario:
Instead of combing through each file, the queries can be profiled with the following changes:
global $gsdbprofile; $gsdbprofile=array();
The dumpgsdbprofile function takes an optional parameter to rank the queries by running time. In addition to watching out for long running queries, also check the total number of queries, as they may point out to short-running queries that are in a loop structure; the total querying time still sums up to a slow response.