The information on 'Sorting and Searching' via DataSource Association is a bit misleading/outdated for DG 2.
DG 2 supports sorting/searching in the client even for data that is not fetched via DB calls. Older widgets did not offer that functionality.
The 'retrieve from memory' for association data sources is actually a bit more complex, since it behaves slightly differently depending on context and type of data. I think this documentation gives a good overview: https://docs.mendix.com/refguide/datasource-runtime/
A lot really depends on how you design your application, but quite generally
* if your data is already commited, or directly commited after edit -> database
* if you work with non-commited, temporary data or changes -> association