MySQL select 10 random rows from 600K rows fast

后端 未结 26 3011
粉色の甜心
粉色の甜心 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:45

    SELECT column FROM table
    ORDER BY RAND()
    LIMIT 10
    

    Not the efficient solution but works

提交回复
热议问题