Jump to content


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


Which method is faster and more effective?

Recommended Posts

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?


Share this post

Link to post
Share on other sites
how about running a test?

function 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 />";

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

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.