fastest way to sort database records
I have a datatable with approx. 5000 records and put it in a dataset/datatable what's the fastest way to sort these ?
- By the database ? (SQL Server 2008)
- By the datatable ? dt.Select("", "ord开发者_高级运维er by columns");
- LINQ ?
Assuming you have a real database server, and the database is correctly indexed, the fastest way to do it would be to push the sort down to the database.
If you assume everything is runing on your laptop, I would still take an indexed sort over an in-memory sort(linq).
I would always perform a sort like this in the database.
精彩评论