This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, Using the Lightspeed 3.11 release, I just ran into a small performance issue: // VERY FAST, distinct is likely done on Server ! I tried doing the "OrderBy" without the "ToList", but that resulted in a "not supported" message. I also tried a different group by: uow.FeeTrades.GroupBy(f => f.TransactionTime.Date).Select(g => new { TransactionTime = g.Key}).ToList(); But that statement was also slow. This was tested against a MS-SQL2008 provider. We ran a query (written by hand) with a groupby, and it was as fast as the distinct written in LINQ. While you could argue that the distinct version is just as nice, the groupby should have performed the same way :) Gr. J. |
|
|
You can attach a Logger to see what is being executed server side, I would expect that from the above both would be executed server side. The main difference you will be seeing however is that with a group by in a LINQ query we need to select back the associated sets of entities for each key that is found and then perform any projection logic client side, so you have an N+1 statement scenario (where N is the number of rows returned in the grouping). So for what you are trying to do, the select distinct is clearly the better way to go :)
Jeremy
|
|