how do we find query execution time???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

how do we find query execution time???

Post by raghavan20 »

I am wondering how sites are displaying that it took n seconds to display the search result.
also, how do they display a graphical moving cursor which denotes that a search is going on???
any logic and suggestions are welcome.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

  1. you time the query operation.
  2. Using http://www.phpclasses.org/browse/package/1704.html
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

you time the query operation
feyd, i dont really understand when you say timing the query.
i am not looking for code, but for logic or algorithm
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there's no real logic behind it.. you get a timestamp before, you get one after.. you find the difference between the two and you have the time taken to execute the query...
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

thats wot I also saw from another website.
Is it possible using SELECT statement to find the execution time???
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

i don't think you can use sql to get the execution time that i know of but what is wrong with using php?

[fake code]
$time = time_stamp_thing();
$do_query();
$time2 = time_stamp_thing();
$executed = $time2 - $time;
echo $executed;
[/fake code]
Post Reply