Jump to content

Archived

This topic is now archived and is closed to further replies.

n8w

get the number of seconds to execute a query

Recommended Posts

I'm trying to improve performance on my database.

How do I get the time it took to execute a query

you know something like

searched 10000 records in .025 seconds ..

thanks
n8w

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.