Optimizing my mysql statement! - RAND() TOO SLOW

后端 未结 6 747
孤独总比滥情好
孤独总比滥情好 2020-12-11 03:26

So I have a table with over 80,000 records, this one is called system. I also have another table called follows.

I need my statement to randomly select records from

6条回答
  •  既然无缘
    2020-12-11 04:12

    You can generate some pseudo random value based on the ids and the current time:

    ORDER BY 37*(UNIX_TIMESTAMP() ^ system.id) & 0xffff
    

    will mix bites from the id, and then will take only the lowest 16.

提交回复
热议问题