Speed up distinct() queries

Based on a suggestion in the RethinkDB issues, distinct() was replaced
with a groupedMapReduce. This speeds it up somewhat and makes it less
prone to the limit of over 100K distinct items.
Speed up distinct table view

Also add min and max entries to get a better sense of the spread of the
values.