MySQL select random row - rand() performance

mysql, php

Solution

Yes, `ORDER BY RAND()` can be very slow in larger result-sets.

An option is to fetch resultset with this statement (into an array):

SELECT sName FROM bpoint WHERE placeID=?; 

After that - use `array_rand($resultset)` to get a randomized item from the `$resultset` query.

Problem

Is it true that `ORDER BY rand()` performance is very slow compared to other solutions? If yes, what are better ways to select random row(s) from the database? My query: ``` SELECT sName FROM bpoint WHERE placeID=? ORDER BY rand() LIMIT 1; ```

Original source

Related problems