Ah thats interesting to know — thanks!
Anupam Jain
1

There is the famous saying

> There are only two hard things in Computer Science: cache invalidation and naming things.

Maintaining precomputed agg results falls under the first, so use it only after you exhausted all other (acceptable) options.

If you only have ~20k records you can probably get away with calculating aggregations on the fly with some query optimization for a while longer. This is, after all, what RDBMSs do best.