Hacker News new | ask | show | jobs
by tomnipotent 1985 days ago
It's very application-specific. If I'm building a message board/forum software where I'm paginating tens of thousands to millions of rows, I'm probably going to do my sorting in the DB. If I'm working with a smaller data set like a users music playlist or favorite movies, I may opt to bring that data in unsorted from the DB and do everything else in app code. Even with small result sets, databases often over-allocate memory for sorting (sort buffers are usually pre-allocated) and even though it's often tunable, a lot of concurrent sorts on small data sets can waste memory.