One NoSQL use case

Simon Willison turned up an interesting NoSQL use case in a crowdsourcing application he built for the Guardian. In the first application he built he used MySQL’s ORDER BY RAND(), which is rather inefficient. (For more on its inefficiency, see the comments on this blog post.) The next time around, he outsourced picking out random results to in-memory database Redis:

The system maintains a redis set of all IDs that needed to be reviewed for an assignment to be complete, and a separate set of IDs of all pages had been reviewed. It then uses redis set intersection (the SDIFFSTORE command) to create a set of unreviewed pages for the current assignment and then SRANDMEMBER to pick one of those pages.


Leave a Reply

Your email address will not be published. Required fields are marked *