My SQL implementation I planned to do a hash join with the smaller table. It was very rudimentary. I don't have indexes though.