10-14-2009, 04:14 PM
[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.
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.