News for hackers. Stuff that matters.
Re:Medium-hard SQL interview questions by barrkel on Saturday May 02, 2020 @05:30PM (#23055085)
In order to determine the distinct items, the items need to be deduplicated. Generally that's done in only two ways: a hash table that skips items already seen, or a sort followed by a scan that skips over duplicates. The hash table is O(1), but the sort is easier to make parallel without sharing mutable state and has more established algorithms to use when spilling to disk.
Re:Medium-hard SQL interview questions by branko_d on Saturday May 02, 2020 @08:40PM (#23056019)
There is a third way: keep the data pre-sorted in the database (via an index).