显示形式如下:19 queries. 16.817 seconds.array(5) {
[0]=>
array(2) {
[0]=>
string(65) "SELECT option_value FROM wp_options WHERE option_name = 'siteurl'"
[1]=>
float(0.000766038894653)
}
[1]=>
array(2) {
[0]=>
string(71) "SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'"
[1]=>
float(0.00127911567688)
}
[2]=>
array(2) {
[0]=>
string(79) "SELECT option_value FROM wp_options WHERE option_name = 'rewrite_rules' LIMIT 1"
[1]=>
float(0.000645875930786)
}
[3]=>
array(2) {
[0]=>
string(79) "SELECT option_value FROM wp_options WHERE option_name = 'rewrite_rules' LIMIT 1"
[1]=>
float(0.000285863876343)
}
[4]=>
array(2) {
[0]=>
string(207) " SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt <= '2006-08-13 06:41:59' AND (post_status = "publish") AND post_status != "attachment" GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 50"
[1]=>
float(12.4344360828)
}}
[0]=>
array(2) {
[0]=>
string(65) "SELECT option_value FROM wp_options WHERE option_name = 'siteurl'"
[1]=>
float(0.000766038894653)
}
[1]=>
array(2) {
[0]=>
string(71) "SELECT option_name, option_value FROM wp_options WHERE autoload = 'yes'"
[1]=>
float(0.00127911567688)
}
[2]=>
array(2) {
[0]=>
string(79) "SELECT option_value FROM wp_options WHERE option_name = 'rewrite_rules' LIMIT 1"
[1]=>
float(0.000645875930786)
}
[3]=>
array(2) {
[0]=>
string(79) "SELECT option_value FROM wp_options WHERE option_name = 'rewrite_rules' LIMIT 1"
[1]=>
float(0.000285863876343)
}
[4]=>
array(2) {
[0]=>
string(207) " SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt <= '2006-08-13 06:41:59' AND (post_status = "publish") AND post_status != "attachment" GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 50"
[1]=>
float(12.4344360828)
}}
/**
* Simple function to replicate PHP 5 behaviour
*/
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}$time_start = microtime_float();// Sleep for a while
usleep(100);$time_end = microtime_float();
$time = $time_end - $time_start;echo "Did nothing in $time seconds\n";
?>
那么看mysql手册的“The Slow Query Log”一节吧,
然后分析log文件就行