On Thu, 2003-05-01 at 17:16, Tim Starling wrote:
The resetting of the random weight upon load is just meant to keep the
pot stirring, and "in theory" shouldn't have any effect at all on
randomness if the random indexes were random to begin with.
Quite right. I would recommend only setting cur_random on article creation.
Eh, may as well. Done.
The MySQL documentation suggests using "ORDER BY
RAND() LIMIT 1", for
versions later than 3.23.
That seems to end up being dreadfully slow... "where used; Using
temporary; Using filesort" Hmm, I wonder if it's changed.... Yeah, okay,
after a minute and a half of "Copying to tmp table" I decided to cancel
that one. Still sucks. :)
The original code used the ORDER BY RAND() trick to fill up a pool of
1000, then grabbed out of those 1000, which was faster than out of the
whole wiki. However when it came time to refill the queue, it was still
incredibly slow, so I replaced it with a nice friendly *indexable*
pre-chosen random number attached to every page.
-- brion vibber (brion @ pobox.com