i have a script which executes several queries for n number of records.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vivek samantray
    New Member
    • Dec 2010
    • 4

    #1

    i have a script which executes several queries for n number of records.

    i have a script which executes several queries for n number of records.How can is set the time in that to know how much time each query took to run
  • JKing
    Recognized Expert Top Contributor
    • Jun 2007
    • 1206

    #2
    A simple easy way is to declare a start time variable before the query and an end time variable after the query has run. The difference between the two will give you the duration.

    Code:
    <?php
    $time_start = microtime(true);
    
    // Query here
    mysql_query();
    
    $time_end = microtime(true);
    $time = $time_end - $time_start;
    
    echo "Did nothing in $time seconds\n";
    ?>

    Comment

    Working...