postgresql-topn
postgresql-topn copied to clipboard
PruneHashTable strategy
in external/topn/topn.c: PruneHashTable function
The comment said "It finds minimum and maximum frequencies first and removes the items which have lower frequency than the average of them."
The code however sort the item from hashtable and only remove hashTableSize - numberOfRemainingElements
items.