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 Guys, I have a scenario where i need to get an object and then the realationships to other objects; oddly enough if I turn eager loading on it is slower than if i implement a hack like the following:
List<CollateralMaster> hack = query.ToList(); foreach (CollateralMaster collateralMaster in hack) { var a = collateralMaster.CollateralDeals; var b = collateralMaster.Address; var c = collateralMaster.CollateralAccounts; }
Am I doing something wrong? Cheers, Josh |
|
|
That's surprising to say the least! It's hard to say whether you're doing anything 'wrong' though it seems unlikely. The only thing I can think of offhand is that the database is performing poorly on the EXISTS sub-queries (whereas for lazy loading it gets simple WHERE clauses on the FK). I would suggest slapping SQL Profiler on it and see if the problem is at the database end and if so whether a bit of tuning can mitigate it. |
|
|
It's not a SQL DB so SQL PROFILER will not help. Is there a difference on how Lightspeed handles SQL and Oracle? |
|
|
No, the same kind of query is issued (though obviously some specifics are different, and of course the two engines may plan the same query in quite different ways). If you don't have an Oracle profiler you can get a crude metric of how long was spent in the database by turning on query logging -- this prints the time taken though obviously you don't get the detail you get with a profiling tool -- but it may be enough to rule slow database-side query processing in or out as a cause. |
|