Count number of MySQL queries executed on page

后端 未结 7 778
慢半拍i
慢半拍i 2020-12-30 07:05

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

相关标签:
7条回答
  • 2020-12-30 07:59

    SMF does its query counting by having its own custom query function:

    function db_query($db_string, $file, $line)
    {
        global $db_cache, $db_count, $db_connection, $db_show_debug, $modSettings;
    
        // One more query....
        $db_count = !isset($db_count) ? 1 : $db_count + 1;
    
        ...
    

    The simplest way to achieve what you're trying to do would be to do the same; make a wrapper for mysql_query and use that instead of mysql_query.

    0 讨论(0)
提交回复
热议问题