Hi,
I can't provide a database but let's assume that my DB schema and indexes are all in good shape.
Then I have this kind of query (Disregard the logic here):
Another is there are no direct relationship between tables and models.
var customers = context.Customers.Join(context.Suppliers.Where(supplier => supplier.Active == true),
cus=> cus.CustomerID,
sup=> sup.SupplierID,
(cus, sup) => cus);
var stores = context.Store.Join(customers,
store => store.StoreID,
cus=> cus.CustomerID,
(store, cus) => store).Where(p=> p.Active == true);
var remainder = 0;
var count = stores.Count();
var pageSize = 50;
var pageCount = Math.DivRem(count , pageSize , out remainder);
if (remainder > 0)
pageCount = pageCount + 1;
for (int x =0; x <= pageCount ; x++)
{
var pagedStores = stores.OrderBy(o => p.StoreID).Skip(x * pageSize).Take(pageSize);
foreach(var store in pagedStores)
{
Console.WriteLine("Store ID: {0}", store.StoreID);
}
}
Example my count is 50k records, so I will have 1k page..
What happen in this query, every page it adds approximately 1 second delay.
So meaning the first page is 1 second, second is 2 second delay and so on and it will come to a point that it will time out...
What do you think is the problem with this approach or do you have any solution that can improve our query?
Note: We already used the EntityQueryPager<T> but still no luck..
We also try juggling some of the QueryStrategy but also failed.
Thanks,
Von