neo4j/neo4j — pull request #3663 by thobe (2014-12-14 15:12:32+00:00)
Title: Statistics divergence for query planned before any data has been created

If there is no data in the graph matching the basic components of a query the statistics will be exceptionally poor for the planning. It is important to ensure that such queries be re-planned as soon as possible.
The previous logic would produce numbers (Infinity and NaN) that made divergence computation impossible, and even in the cases where it would be possible to compute divergence, a statistics vector with all zeros (which would be the case if the graph contains no data) would never be considered diverged, regardless of how much the data changed.
This change set ensures that no impossible statistics are ever produced, and introduces a special case for all-zero statistics vectors, falling back equality comparison between the vectors in this case.