Today one colleague of mine asking me for tips on improving the DataTable.Select() performance. Apparently she has a data table which contains tens of thousands of records which some of the rows need to be processed together.
This particular question left me scratching my head. The only thing that I can suggest were:
- Make sure when populating the data table from the database, the data are already sorted
- Make sure the filter parameter of the Select() method is selecting by integer data
Come to think of it, I don’t really know how actually the Select() method is done. Is it using Binary Search, Linear Search, Interpolation Seach or any other search method that I never come across with.
If the case is when the data was fetched from database already in order of an ID, let say CustomerID and the DataTable.Select() is using “CustomerID=1001″, is there any way to optimize this further?
I’ll get back to you when I found the answer. Or maybe you have the answer?