So following on from this question, I was looking into why I was seeing poor query performance with SQL Server Compact that was blocking the UI thread. I have LazyLoading disabled and explicitly load the data that I need ahead of time.
To isolate this a little, I ran a test using the following query on the Northwind database to load all Orders, and for each Order load the associated OrderDetails, and for each OrderDetail load the Product and Supplier:
entities.Orders.Include(o => o.Order_Details
.Select(od => od.Products.Suppliers))
.Load();
It took around 9 seconds to execute!
As a comparison I ran this against the Northwind database on my local SQL Server Express and it completed in < 0.1 seconds.
What is wrong with the .Select() that is causing the issue in this query? Why is this select causing such a long execution time for SQL Server Compact, but is fine when ran against SQL Server?