Populate table id for aggregate stats query.

Reviewer: @rlane

This was part of the flow-stats long running task change, but now we want aggregate stats working on its own.