MySQL select 10 random rows from 600K rows fast

后端 未结 26 2916
粉色の甜心
粉色の甜心 2020-11-21 05:06

How can I best write a query that selects 10 rows randomly from a total of 600k?

26条回答
  •  感情败类
    2020-11-21 05:49

    Its very simple and single line query.

    SELECT * FROM Table_Name ORDER BY RAND() LIMIT 0,10;
    

提交回复
热议问题