by gregable · 1y ago · 0 comments
There's also a distributed version, easy with a map reduce.
Or the very simple algorithm: generate a random paired for each item in the stream and keep the top N ordered by that random.
I discuss these issues more here: https://blog.moertel.com/posts/2024-08-23-sampling-with-sql....