I have some nasty performance issues when paging through grid control, since we have lot of registers (300k or more), we are using the server-side aproach, but for some reason the last page takes forever but if you go to page 2,3,4 etc. is fast, its seems when you are close to last pages the time increases why? it not should be the same or similar amount time going to page 4 or last page?
So when we bring a lot of registers, go to second page can take a second or seconds and the last page takes sometimes minutes! I see a big load in the database server when click on last pages. I tested this on version 2014 and 2016.
Is there some parameter or configuration to improve this or is it a kind of bug? or why this could happen?
6 Answers, 1 is accepted
When server paging is performed, the Grid and DataSource do not participate in the actual paging. The DataSource only sends the needed page (index) and pageSize parameters to the server and then returns the result from the server to the Grid. This being said, as long as the page size in the Grid is not too large, there shouldn't be a visible slowdown, no matter what page the Grid is on.
This being said, the problem is most probably in the logic that retrieves the page in question from the database. You can read a discussion about performance problems with paging large data in Entity Framework (if you are using it) here:
Entity Framerowk Skip/Take is very slow when number to skip is big
There are a lot of other threads discussing slow handling of paging with large data sets and I would advise you to do such a search based on the specific technologies used in your project backend.
If you want us to take a look to confirm that all else is properly configured as far as the Grid and DataSource are concerned, you can paste the relevant code and I will check it for any visible issues.
Thank you for your response, in my case we create an IQueryable and build the query, after that we use Kendo.Mvc.Extension
and call the method ToDataSourceResult.
If you are already doing custom filtering, you should consider using custom binding altogether. This will give you better control over the exact way the filtering, sorting and paging are applied. You can read more about configuring custom binding here:
Custom Binding documentation
and see a demo here:
Custom Ajax Binding
Also, just in case, can you show the code in the FiltrarM method? Could you confirm that the logic inside it is not reading the entire data from the database before filtering it?
Here is the class with the method FiltrarM
Indeed, it looks like you are already implementing custom filtering, so it is best to also add sorting and paging to it as shown in the Custom Ajax Binding demo and remove the ToDataSourceResult() call. This will allow you the freedom to apply optimizations of your own to the way the data is queried.
If the usage of IQueryable does not provide good enough results in terms of performance, you could consider executing a stored procedure passing the parameters extracted from the request, so you can control the exact way the database is queried.
Thank you so much for your help and advices.