http://dev.mysql.com/tech-resources/articles/using-new-query-profiler.html
以上链接链接了如何在任何查询后获取sql配置文件信息.
实现它的最佳方法是创建一个数据库类,并使其具有“profile”标志,以打开查询记录和相应的信息,如上面链接所示.
例:
Class dbthing{
var $profile = false;
function __construct($profile = false){
if($profile){
$this->query('set profiling=1');
$this->profile = true;
}
...
}
function query($sql, $profile_this == false){
...
if($this->profile && !$profile_this)
$this->query("select sum(duration) as qtime from information_schema.profiling where query_id=1", true);
... // store the timing here
}
}