Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Good point, but in the case of OP, without condition, it will do a full table scan.

Also, any case of "WHERE filter ORDER BY random() LIMIT n" means "I want a tiny sample from a broad filter". So it might not be a full table scan, but it will still assign value to a lot of rows.



> Good point, but in the case of OP, without condition, it will do a full table scan.

And that has nothing to do with the ORDER BY random().


Yes it does, because of LIMIT N. An unordered result set will stop after the first N matches.


Now that is correct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: