Use limited queries for stats computation

When we streamed responses in, the driver could still receive a batch that was large enough to choke it. To be safe, we limit the number of responses.

Add some other optimizations that likely only kick in for large surveys.

/cc @hampelm