how would I count the number of sql queries executed on one page load?
I have a similar script to time taken for page to be generated, but not for how many queries h
After Quassnoi comment i put this in the start of script:
$res = mysql_query("SHOW SESSION STATUS LIKE 'Questions'");
$row = mysql_fetch_array($res, MYSQL_ASSOC);
define("START_QUERIES",$row['Value']);
and this:
$res = mysql_query("SHOW SESSION STATUS LIKE 'Questions'");
$row = mysql_fetch_array($res, MYSQL_ASSOC);
define("STOP_QUERIES",$row['Value']);
you can see total num of queries with:
echo "No of queries: ".(STOP_QUERIES-START_QUERIES-1);
I don't know why use -1, maybe it counts mysql_select_db statement (or smth) also, but it works pretty good on my localhost