Hacker News new | ask | show | jobs
by zombieprocesses 3008 days ago
Is this an advertisement? Because it reads like one.

Postgresql and most mature database systems already have topN/offset/paging solutions.

Also, what's the point of aggregating JSONB data? If you need to calculate topN, why not normalize the data properly and index the data? Then top N will be blazing fast without needing an extension?

If the data set is extremely large then you can maintain an internal "Top N" table that gets calculated when data is added/removed. It all depends on the workload, but inserts/updates/deletions may be slightly slower, but reads of topN will be constant speed.

1 comments

This is an entirely new PostgreSQL extension. Within the post we talk about group by, order by work fine for smaller datasets but for larger datasets the amount of time to compute and roll things up is not feasible. TopN or TopK is a very common algorithm for approximate counts of top items when you have large enough datasets.