How to do random ordering in MySQL. Should I use random() or uuid()

I want to get randomized results for a query. I read that using RAND() is quite slower. Can I use order by uuid_short() ? Will that be better ?

Answers


uuid_short() is about two times slower than rand(), so no, you should not use uuid_short() instead of rand().

mysql> select benchmark(100000000, rand());
1 row in set (3.25 sec)

mysql> select benchmark(100000000, uuid_short());
1 row in set (6.04 sec)

Need Your Help

Append text to stderr redirects in bash

bash exec stderr

Right now I'm using exec to redirect stderr to an error log with

Error level analysis in Image

opencv image-processing

How do I compute ELA for an image? I would like to get similar ELA image using opencv http://fotoforensics.com/tutorial-ela.php