Status rows written in the same second have equal timestamps, and the
batched query returns them in an order that depends on which other
resources are in the request. When a recovery event sorted before the
failure it followed, the resource stayed unhealthy until its next event.
Break timestamp ties by id in the queries and in computeBuckets.
Fixes#3994