Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo UI DataSourceRequest performance impact

Tags:

kendo-ui

I'm using KendoUI grid and using its ToDataSourceResult to filter my data (as suggested by the documentation) but i'm worried about the performance impact.

Based on my understanding, the following suggested code get all records from database into memory and performm ToDataSourceResult extension method to filter the records in memory (LINQ fluent api concept). Will this have great performance impact if i have lots of records?

I suppose having a query to the database with the "where" clause upfront will have better performance... please advise.

Here's what suggested in the documentation

var countries = _database.Countries.GetAll();
return Json(countries.ToDataSourceResult(request, record => new
{
     record.Id,
     record.Name,
     record.Currency,
     record.TimeZone
}));

This is other option without using ToDataSource filter

var selectedCountries = _database.Countries.GetCountryStartWith("m")
like image 254
JeeShen Lee Avatar asked Jan 30 '26 19:01

JeeShen Lee


1 Answers

It depends on what your GetAll method returns. If it returns IQueryable from a LINQ-enabled provider (Entity Framework, Linq to SQL or anything else) all operations will be performed at database level (not in memory). If it returns all records - well you have a problem even before using ToDataSourceResult.

like image 76
Atanas Korchev Avatar answered Feb 01 '26 12:02

Atanas Korchev