gaza165 Posted September 5, 2008 Share Posted September 5, 2008 Can someone please remind me of the code to get the time it takes for sql query to run i.e Query took 0.04secs to complete... Thanks Garry Link to comment https://forums.phpfreaks.com/topic/122856-query-execution-time/ Share on other sites More sharing options...
trq Posted September 5, 2008 Share Posted September 5, 2008 You meen something like this? That was the first thing google found when asked about a php script timer. Link to comment https://forums.phpfreaks.com/topic/122856-query-execution-time/#findComment-634490 Share on other sites More sharing options...
ranjuvs Posted September 5, 2008 Share Posted September 5, 2008 if you want php sol then it is $time_start = microtime(true); Query goes here $time_end = microtime(true); $time = $time_end - $time_start; or Mysql way then try using explain command EXPLAIN yourQuery Link to comment https://forums.phpfreaks.com/topic/122856-query-execution-time/#findComment-634493 Share on other sites More sharing options...
gaza165 Posted September 5, 2008 Author Share Posted September 5, 2008 I always thought there was an easier way to do this.... Im doing it on an SQL statment just to notify the user how long the query took to execute. $result = mysql_query("INSERT INTO chat (nick, message) values ('$nick','$message') "); Am sure it is simpler than this. Thanks G Link to comment https://forums.phpfreaks.com/topic/122856-query-execution-time/#findComment-634494 Share on other sites More sharing options...
trq Posted September 5, 2008 Share Posted September 5, 2008 Am sure it is simpler than this. It doesn't get much (in fact any) simpler. Link to comment https://forums.phpfreaks.com/topic/122856-query-execution-time/#findComment-634504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.