Skip to main content

Timeline for How to request a random row in SQL?

Current License: CC BY-SA 2.5

2 events
when toggle format what by license comment
Nov 14, 2023 at 19:13 comment added Traderhut Games This is interesting. If I'm reading this right, it starts evaluating rows, and picks off the bottom 1% of the values (>= 0.01), so if you have 1,000,000 rows, and you pick up 10,000 of those that match, that will be a good random sample set. However, ideally, you want to look at your count() and number of rows you want, and divide those to get the % to pick. (I.E. if you wanted just 100 rows to allow a distribution over all of them, you could do 100/1000000 or 1/10000 or 0.0001 if you selected 0.01 you would hit your 100 early and never get later rows.
May 28, 2009 at 18:23 history answered Rob Boek CC BY-SA 2.5