Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
4.80/5 (5 votes)
Hello Guys,

I heard that Linq to SQL can perform paging.
But which is the efficient way of doing a paging?

* SqlDataSource (caching)
* Linq
* Custom Paging (SQL-sproc)

Comparison for both initial loading and postback.
Assuming that the number of data in db is 1Million.

Suggestions are very much appreciated.
Posted
Updated 2-Mar-12 23:37pm
v2
Comments
thatraja 3-Mar-12 5:35am    
Nice question, Counter 5!
deepakaitr12345 2-Apr-12 7:14am    
I think you should go for the state management for this like session,viewstate
you would get more on this related to performance.

Thanks

Hey,

You should use "Custom Paging (SQL-sproc)" create a SP which takes param for Page number, PageSize.

use the row number into u'r Sql Query to get the records from Page Number and Size.


Looking forward for your response.
 
Share this answer
 
No doubt at all it is custom paging.


Comparing the Performance of Default and Custom Paging

Since custom paging only retrieves the needed records, whereas default paging returns all of the records for each page being viewed, it s clear that custom paging is more efficient than default paging. But just how much more efficient is custom paging? What sort of performance gains can be seen by moving from default paging to custom paging?

Unfortunately, there s no one size fits all answer here. The performance gain depends on a number of factors, the most prominent two being the number of records being paged through and the load placed on the database server and communication channels between the web server and database server. For small tables with just a few dozen records, the performance difference may be negligible. For large tables, with thousands to hundreds of thousands of rows, though, the performance difference is acute.



for more details look at this link for Efficiently Paging Through Large Amounts of Data

http://www.asp.net/web-forms/tutorials/data-access/paging-and-sorting/efficiently-paging-through-large-amounts-of-data-cs[^]

Thanks,
SP
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900