Skip to content
  • Daniel Vrátil's avatar
    Reduce collection statistics queries · c7944585
    Daniel Vrátil authored
    For certain cases we can now update the cached statistics in
    CollectionStatistics incrementally instead of invalidating the
    cache and querying DB to calculate it again. The calculation is
    rather expensive (one of the most expensive queries we have) and
    the time we spent recalculating the stats quickly adds up to secons.
    
    Currently we only support incremental stats update for flags change
    within a single collection and for appending new items which,
    especially in the second case, should notably reduce the amount of
    the super-heavy statistics queries.
    
    In any other case we currently fall-back to invalidating the cache
    and calculating the stats on demand.
    c7944585