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

Filtering Performance

6 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Monte
Top achievements
Rank 1
Monte asked on 17 Oct 2011, 11:59 PM
I am using a radgrid with filtering enabled to display a report. The full report contains ~16000 records and takes upwards of 1 minute to load. When I use the built in filtering to filter by a column it still takes just as long to load. I'm using linq to provide the datasource and I would assume it would be faster to query linq with the filter directly. I ran the linq generated query directly on the database with the added filter and sure enough it took less than a second to get the much reduced dataset (~70 rows).
So it seems like the radgrid is query all 16000 records from the database and then internally filtering down to 70 rows. So the question is, is the correct behaviour and if it is, is there a way to add the filter directly to the linq query?

6 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 18 Oct 2011, 05:34 AM
Hello,

please check below, in this custom filter is used.  
http://www.telerik.com/help/aspnet/grid/grdfilteringfordatetimecolumnwithdataformatstring.html

Let me know if any concern.

Thanks,
Jayesh Goyani
0
Monte
Top achievements
Rank 1
answered on 18 Oct 2011, 10:06 PM
Hmm not sure how that applies, that seems like its for creating a filter on the fly, the filter expression itself is fine in my case I just don't know where the filter is being applied.
When I create my linq datasource I have access to the FilterExpression. For example it looks like "Extra4 like '%test%'". But the grid doesn't seem to apply this filter until it has already queried the database. I haven't been able to find a way to add that filter directly to a linq datasource either.
0
Pavlina
Telerik team
answered on 24 Oct 2011, 02:03 AM
Hello Monte,

Thе demo linked below illustrates the optimized performance techniques incorporated in the ASP.NET 3.5 build of RadGrid. The control takes advantage of the new LINQ syntax introduced in ASP.NET 3.5 and performs aggregate calculations or executes sorting/filtering/paging operations by means of native LINQ expressions.
http://www.telerik.com/community/code-library/preview-thread/aspnet-ajax/grid/storing-multiple-grid-settings-in-database-via-profile.aspx

Give it a try and let me know if it helps.

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Monte
Top achievements
Rank 1
answered on 24 Oct 2011, 09:20 PM
Thanks, that was interesting but still didn't seem to apply. For now I've solved the problem by taking the filter when I'm creating the datasource, translating it into Linq and using dynamic linq to apply it to the datasource at this point. The query went from being >30seconds to ~6 seconds.
So I take [Extra6] LIKE '%Test%' and translate it to Extra6.Contains("Test"). This involved breaking down the sql, checking the components and rebuilding in linq which isn't prettiest code. So I'm still open to other options.
Thanks
Monte
0
Pavlina
Telerik team
answered on 28 Oct 2011, 11:48 AM
Hello Monte,

Please excuse me for the mistake. I have in mind the 300 000 Rows with LINQ demo of RadGrid:
http://demos.telerik.com/aspnet-ajax/grid/examples/performance/linq/defaultcs.aspx

Check it out and let me know if it is an option for you.

Best wishes,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Monte
Top achievements
Rank 1
answered on 28 Oct 2011, 11:08 PM
Thanks that gave me some ideas to work with.
Tags
Grid
Asked by
Monte
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Monte
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or