Indeed we should count the number of nodes updated instead of the number of
queries.
rebuild: 1 write and 1 select on each node
update: (1 write + 3 select + 2 write on average ½ all nodes + 1 write on child
of id) on each ids
So the threshold is:
2 * count < (4 + 2 * count / 2 + 1 * x) * len(ids)
2 * count < (4 + count + x) * len(ids)
which can be approximated to
2 * count < count * len(ids)
2 < len(ids)
issue5399
review20861002