• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
select whit random? help :)

#4
[eluser]jedd[/eluser]
Side-note : using random sort order is expensive, especially on big tables.

Typically it will be faster to calculate the number of rows you have in the table, use a PHP function to calculate n random numbers within that range, and modify your SELECT to use a 'WHERE IN ( ... )' construct.

Yes, I do note you say ten items will exist in this particular table, but it's not clear if that's an immutable set of data.


Messages In This Thread
select whit random? help :) - by El Forum - 10-14-2009, 08:26 AM
select whit random? help :) - by El Forum - 10-14-2009, 08:31 AM
select whit random? help :) - by El Forum - 10-14-2009, 03:35 PM
select whit random? help :) - by El Forum - 10-14-2009, 04:14 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.