n8w Posted April 1, 2006 Share Posted April 1, 2006 I'm trying to improve performance on my database.How do I get the time it took to execute a query you know something likesearched 10000 records in .025 seconds .. thanksn8w Quote Link to comment https://forums.phpfreaks.com/topic/6354-get-the-number-of-seconds-to-execute-a-query/ Share on other sites More sharing options...
wickning1 Posted April 2, 2006 Share Posted April 2, 2006 Usually you do it in your application. If you are using PHP, you can do something like this:[code]$start = microtime(TRUE);$result = mysql_query($query);$querytime = microtime(TRUE) - $start;[/code] Quote Link to comment https://forums.phpfreaks.com/topic/6354-get-the-number-of-seconds-to-execute-a-query/#findComment-23032 Share on other sites More sharing options...
n8w Posted April 2, 2006 Author Share Posted April 2, 2006 thanks so much! .. I have some interesting results.. do you know why I get a negative number on[a href=\"http://www.illustrationmundo.com/illustrators.php\" target=\"_blank\"]http://www.illustrationmundo.com/illustrators.php[/a]but a positive number on[a href=\"http://www.illustrationmundo.com/news.php\" target=\"_blank\"]http://www.illustrationmundo.com/news.php[/a]you can see the result time on the bottom left hand corner of the page Quote Link to comment https://forums.phpfreaks.com/topic/6354-get-the-number-of-seconds-to-execute-a-query/#findComment-23070 Share on other sites More sharing options...
wickning1 Posted April 2, 2006 Share Posted April 2, 2006 Hard to say without seeing what you did. Make sure you use microtime(TRUE) and not just microtime(), as the latter will not be correct. Quote Link to comment https://forums.phpfreaks.com/topic/6354-get-the-number-of-seconds-to-execute-a-query/#findComment-23084 Share on other sites More sharing options...
fenway Posted April 2, 2006 Share Posted April 2, 2006 You can access what you see on the command-line return, but only via the C API functions; you might as well profile it in middleware. Quote Link to comment https://forums.phpfreaks.com/topic/6354-get-the-number-of-seconds-to-execute-a-query/#findComment-23250 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.