THE BETTER WAY TO ORDER BY RAND in scope
ORDER by RAND() in MySQL is super slow. Jan Kneschke had wrote a article ORDER BY RAND() 3 years ago.This article explains a lot about his alternative ORDER BY RAND solution
But it’s find_by_sql version, I just refactor it to scope version THE BETTER WAY TO ORDER BY RAND in scope. And discuss more scenarios.
Post a comment