Trying to learn something new every day!
Web development
MySQL rand() benchmark, don’t use rand()
0203 days
The need to get a certain amount of data randomly to present on a website so that your audience can view that your website is alive and, in the most cases, to be aware of the variety of products you have to present. It’s very common as also the performance side effect.
There are so many approaches for rand() replacements: ‘rand() mixed soup variations’, using join’s, etc but I found that with queries over very large tables none of them actually ease you from the pain of having a lot of heavy queries over your database.
Rand is not efficient and if you need to retrieve random rows having several columns on the where clause it’s even worst.


