JDBI-like interface for breaking out stats by multiple values

Not ready for merging. An initial proposal.