Fork me on GitHub
#off-topic
<
2019-08-11
>
murtaza5209:08:46

currently I am sorting data using the sort fn, the dataset is small (100 entries). I have specified a custom comparator for sorting the dataset. at what point does shifting to a db makes sense (assuming the data is stored in a db). What type of db is a good choice to do such a sorting ? or can sorting in db can be as efficient as code ?

kenj22:08:05

I general, switching to a DB when your data doesn’t fit into memory is a good call.

kenj22:08:04

A DB index, is often implemented as a sorted tree. As such, just creating an index on the data you want sorted will let you return subsets if the data sorted, rather quickly (this is an overly simple explanation)