Question

I have two SqlDataSource controls on a page. One loads high level data and the other loads more details based on which high level item you choose. It is a part of a large search that has over 900,000 records and I am looking for ways to speed it up. Whether it is options I can add onto the SqlDataSource, things I can do to the sql query, or use an alternative such as an ObjectDataSource.

I changed the DataSourceMode to DataReader because I heard it was faster and uses less memory. I also noticed that the paging is really slow.

I am doing the following from my this website, http://mosesofegypt.net/post/2008/02/Building-a-grouping-Grid-with-GridView-and-ASPNET-AJAX-toolkit-CollapsiblePanel.aspx, but obviously with my data which is over 900,000 records and I am unsure how I can add paging to the second gridview, because right now, it is only on the top-level gridview

Was it helpful?

Solution

I don't think your data source control itself would need to be the target for any optimizations. It is only going to work with the data that you get from it (meaning you should optimize your SQL) or the data put into it before sending it off to SQL (meaning you should optimize your application code).

OTHER TIPS

  1. I would start with server-side paging for your data in asp.net.
  2. I would make sure to index your database tables to get maximum performance. Also use query analyzer to see pain points in your query performance.
  3. If you are searching I would recommend using Full Text Indexing that SQL server provides.

When I used to have to track large amounts of data I found it was better to not use the default pagin and instead override to only collect 10 or 20 rows a time from the database. You do need a decent indexing process so the code knows which 10 or 20 rows or so it is displaying but it does speed things up.

Personally, I would look into using the ObjectDataSource, and doing custom paging. 4GuysFromRolla.com has some great tips on how to do the Custom Paging.

The default paging in the SQLDataSource is very slow / poor performance, once you start reaching larger amounts of records.

The reason? Every call to refresh the data (changing the page, editing a record, etc) gets ALL the data again... and then the client displays the page you are actually on.

With Custom Paging and the ObjectDataSource... you can retrieve only the smaller subset of records you truly need right now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top