mkosmosports Posted October 22, 2006 Share Posted October 22, 2006 I have a database full of teams and dates when the teams start out. For this particular tournament teams enter at 4 different stages (dates)...What is quicker?1. Do four different mysql queries which would return only the teams during selected date intervals?2. Do one query which would return all teams and then use php to separate out what is to be returned when?Thanks.. Quote Link to comment https://forums.phpfreaks.com/topic/24751-which-method-is-faster-and-more-effective/ Share on other sites More sharing options...
.josh Posted October 22, 2006 Share Posted October 22, 2006 how about running a test?[code]<?phpfunction timer(){ list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec);}$t1 = timer();// do method 1$t2 = timer();// do method 2$t3 = timer();$total1 = $t2-$t1;$total2 = $t3-$t2;echo "Method 1 : $total1 <br />";echo "Method 2 : $total2 <br />";?>[/code]edit: I stoled this code snippet from barand's poll. not that i couldn't have done it myself, but i'm lazy such and all. just giving credit where credit is due ;D Quote Link to comment https://forums.phpfreaks.com/topic/24751-which-method-is-faster-and-more-effective/#findComment-112698 Share on other sites More sharing options...
mkosmosports Posted October 22, 2006 Author Share Posted October 22, 2006 Thanks Crayon Violent. I will indeed try this and post the results when its all done! Quote Link to comment https://forums.phpfreaks.com/topic/24751-which-method-is-faster-and-more-effective/#findComment-112699 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.