I’m using DevExpress DataGrid in my web app. This DataGrid has sorting and filtering enabled. When the user tries to sort and filter columns, some parameters are send to the WEB API. Suppose the table of the database contains 15 million records.
There are two options for API calculations:
-
Using EF Core:
For example, I use the following code (a simple example):var myData = await _sqlServerContext.Logs.AsQuerable(); //When debugging, the whole dataset (15000000 records) is loaded here.
.
.
.
//Do some filtering calculations
.
.
.
If(nameFilter != null)
{
myData = myData.Where(x => x.Name == “Alex”);
}
If(ageFilter != null)
{
myData = myData.Where(x => x.Age > 36);
}
If(nameFilter != null && ageFilter != null)
{
myData = myData.Where(x => x.Name == “Alex” && x.Age > 36);
}return Ok(mydata);
-
using Dapper and pure SQL query.
My question is which one will use less resources on the server considering I have 15 million records on the database table? Which one has better performance?