How can I best write a query that selects 10 rows randomly from a total of 600k?
This is super fast and is 100% random even if you have gaps.
x of rows that you have available SELECT COUNT(*) as rows FROM TABLEa_1,a_2,...,a_10 between 0 and xSELECT * FROM TABLE LIMIT 1 offset a_i for i=1,...,10I found this hack in the book SQL Antipatterns from Bill Karwin.