This is a migrated thread and some comments may be shown as answers.

Is Filtering with a LinqDataSource Suppose to Filter at SQL Server?

3 Answers 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin Warnke
Top achievements
Rank 1
Kevin Warnke asked on 20 Jul 2010, 03:28 PM
I was basing my code off the "Performance 300,000 rowcount example".  I just assumed that by following that model that the filtering MUST be done at the SQL server level.  Is that not correct?

I created a similar grid with a LinqDataSource that uses a DataContext that is LinqToSql.

The paging seems to be done at the SQL server level but when I filter I don't see any additional "where" clause which tells me that SQL server is returning ALL the rows and then .NET/Linq/Telerik/SomeoneElse is doing the filtering.

Is that right?  Or do I not have something configured properly so that the LinqDataSource will cause the WHERE to show up at SQL Server?

Thanks,
Kevin

3 Answers, 1 is accepted

Sort by
0
Kevin Warnke
Top achievements
Rank 1
answered on 20 Jul 2010, 03:58 PM
Follow up:

After re-reviewing the SQL traces it is running SQL with the correct where and order by (filter/sort).

However, BEFORE it runs the "correct" one it's repeating the execution of the original query.  So it's basically running 2 queries even though it only needs to run the second.

Any ideas on timing here and why it's doing that?

Thanks,
Kevin
0
Kevin Warnke
Top achievements
Rank 1
answered on 20 Jul 2010, 05:11 PM
Well another thread, another one I answer on my own LOL.

The problem was I had ViewState disabled for the grid.  Apparantly when the grid is disabled it automatically re-creates itself even though it's not needed.

Anyone know how to supress this?  Or get ViewState to only include the details needed (page #, etc.) versus all the data too?

Thanks,
Kevin
0
Iana Tsolova
Telerik team
answered on 23 Jul 2010, 03:52 PM
Hello Kevin,

Indeed, your findings anout the grid bound to LinqDataSource control are right - the fileting, paging and sorting are done on the SQL Server as the LinqDataSource supports them.
 
Regarding your last question: When RadGrid ViewState is disabled, RadGrid is reboundon each postback as you already observed. I suggest that you find the below articles for more information on how to optimize RadGrid ViewState:

http://www.telerik.com/help/aspnet-ajax/grdviewstateoptimization.html
http://www.telerik.com/help/aspnet-ajax/grdsavinggridviewstateinsession.html

Best wishes,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Kevin Warnke
Top achievements
Rank 1
Answers by
Kevin Warnke
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or