1. A computer-executed method for gathering statistics from changed subtrees in a hierarchically-organized collection of resources comprising: after traversing the collection of resources to gather statistics for the collection in connection with a first traversal of the collection that is performed previous to a second traversal of the collection: in response to detecting a change to a particular resource in the hierarchically-organized collection of resources: identifying a set of ancestor container resources of the particular resource, and adding, to a data structure, an identifier for each container resource of the set of ancestor container resources of the particular resource; while traversing the collection to gather statistics for the collection in connection with the second traversal of the collection: determining whether an identifier for a first container resource in the collection of resources is stored in the data structure; wherein the set of ancestor container resources comprises the first container resource; in response to determining that an identifier for the first container resource is stored in the data structure, gathering statistics for one or more child resources of the first container resource to produce gathered statistics; determining whether an identifier for a second container resource in the collection of resources is stored in the data structure; in response to determining that an identifier for the second container resource is not stored in the data structure, skipping gathering statistics for immediate children of the second container resource; wherein the method is performed by one or more computing devices.