Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
K2L8M11N2
· 4y ago · 0 comments
I can't think of a reason why getting an article with ID of randomIntBetween(0, count(articles)) would be slow (maybe UUID primary keys?)
Comments
[–]
Sohcahtoa82
4y ago
Even if you used UUIDs, couldn't you just "select count(id) from articles" to get the list of articles, generate a random number between 0 and the count, then "select id from articles offset {index}"?