Results 1 to 3 of 3

Thread: detecting query speed using php

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default detecting query speed using php

    How can I check the speed of a query using php? I ran a query that I thought would take some time to complete that involved a bunch of PCRE to format about 150 fields and it took very little time. I am about to do the same with another 600 fields.
    Last edited by james438; 03-18-2010 at 05:48 AM.
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    This should do:

    PHP Code:
    <?php
    $time_start 
    microtime(true);

    // Code here

    $time_end microtime(true);
    $time $time_end $time_start;


    echo 
    "Executed in $time seconds\n";
    ?>
    Taken from: http://uk.php.net/manual/en/function.microtime.php

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Awesome, thanks
    To choose the lesser of two evils is still to choose evil. My personal site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •