My question is based on the SO MySQL select 10 random rows from 600K rows fast. It is known
SELECT column FROM table
ORDER BY RAND()
LIMIT 10
is too slow for huge tables, another tricks and methods are used to extract some rows.
But what if I use WHERE:
SELECT column FROM table
WHERE colA=123
ORDER BY RAND()
LIMIT 10
What about the performance, if WHERE actually excludes at least 99.99% wrong rows among 600k?
By another words, what works first in this query - WHERE or ORDER BY RAND()?
If WHERE works first, does this mean ORDER BY RAND () sort only 60 rows (not 600k) and works fast?