mysql查询随机返回效率问题(使用join 和 rand() 耗时 0.001s)
使用join 和 rand() 耗时 0.001s
SELECT * FROM `t_topic` AS t1 JOIN ( SELECT ROUND( RAND() * ( (SELECT MAX(id) FROM `t_topic`) - (SELECT MIN(id) FROM `t_topic`) ) + (SELECT MIN(id) FROM `t_topic`) ) AS id ) AS t2 WHERE t1.id >= t2.id ORDER BY t1.id LIMIT 10;
个人博客:http://www.qbeee.cn