ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:performance:suspicioussql

This is an old revision of the document!


suspiciousSql

Syntax
mixed suspiciousSql()

Description

The function suspiciousSql() returns a list of SQL statements with high average execution times collected by the performance monitor logSql feature.

Usage

/*
* Connection to DB2 database
*/
 
$perf = newPerfMonitor($db);
 
/*
 * Enable logging
*/
$db->logSql();
 
/*
 * Execute suspicious SQL statement
*/
$SQL = "SELECT * FROM act where actno > 200";
 
$db->execute($SQL);
 
 
$h = $perf->suspiciousSql();
 
print $h;

<html> <h3>Suspicious SQL</h3> <font size=1>The following SQL have high average execution times</font><br> <table border=1 bgcolor=white><tr><td><b>Avg Time</b><td><b>Count</b><td><b>SQL</b><td><b>Max</b><td><b>Min</b></tr> <tr><td>0.065087<td align=right>1<td><font size=-1><a target=sql205519396 href=“?hidem=1&exps=1&sql=SELECT+%2A+FROM+act+where+actno+%3E+%27A%27&x#explain”>SELECT * FROM act where actno &gt; 200</a></font><td>0.065087<td>0.065087</tr><tr><td>0.062797<td align=right>1<td><font size=-1><a target=sql1678387404 href=“?hidem=1&exps=1&sql=insert+into+adodb_logsql+%28created%2Csql0%2Csql1%2Cparams%2Ctracer%2Ctimer%29+values%28+CURRENT+TIMESTAMP%2C%3F%2C%3F%2C%3F%2C%3F%2C%3F%29&x#explain”>insert into adodb_logsql (created,sql0,sql1,params,tracer,timer) values( CURRENT TIMESTAMP,?,?,?,?,?)</a></font><td>0.062797<td>0.062797</tr></table> </html>

v5/performance/suspicioussql.1629662856.txt.gz · Last modified: 2021/08/22 22:07 by peterdd