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
|
We have a SQL database with 3 tables. Client > ClientContact < Contact We setup the model and defined an Aggregate to eager load data from the 3 tables. When I examined the SQL query LightSpeed generated from our linq query I was surprised to see that it batched 3 separate queries. If I were to hand write the SQL I would create one query with 2 inner joins. Other tests using Entity 4 and NHibernate generated a query with joins. Why does LightSpeed generate a separate query for each table?
|
|
|
We use seperate queries because each table is loaded independantly according to its rules. Its certainly would be possible for us to do this with joins but the original implementation pre-dates our introduction of join support and there has been no pressing need to change this. The independant statements are batched if possible so they are actually issued as a single batch to the database server so you should not be seeing any performance difference since the sets being operated on and the results being returned from the database would be equivilant.
Jeremy |
|