How does the paging function work behind the scenes?

Posts   
 
    
scaless
User
Posts: 22
Joined: 28-Mar-2011
# Posted on: 01-Apr-2011 23:36:24   

Hello,

I am evaluating LLBLGen Pro right now and I just started in looking into the paging feature for large datasets. I was curious as to what the DataAccessAdapter.FetchEntityCollection method does behind the scenes when the overload with the paging parameters is called.

Is it completely repopulating the collection, or is it just adding the next n rows to the collection? Or doing something else all-together?

Thanks, Shaun

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 02-Apr-2011 04:54:16   

LLBLGen performs paging at server-side when possible. There are cases when no server-side paging is possible. For instance (copied from manual):

Fetching massive amounts of data by fetching large lists of entities. LLBLGen Pro supports paging (and limiting the # of rows returned), which is often key to process through large sets of data. Use paging on the RDBMS if possible (so a query is executed which returns only the rows in the page requested). When using paging in a web application, be sure that you switch server-side paging on on the datasourcecontrol used. In this case, paging on the grid alone is not enough: this can lead to fetching a lot of data which is then loaded into the grid and paged there. Keep note that analyzing queries for paging could lead to the false assumption that paging doesn't occur, e.g. when the query contains a field of type ntext/image/clob/blob and DISTINCT can't be applied while it should have (e.g. due to a join): the datareader will do DISTINCT filtering on the client. This is a little slower but it does perform paging functionality on the data-reader so it won't fetch all rows even if the query suggests it does.

You also should read this post from Frans Bouma (the LLBLGen Lead Developer) about how paging is performed: http://weblogs.asp.net/fbouma/archive/2007/06/05/sqlserver-2005-paging-there-is-a-generic-wrapper-query-possible.aspx

David Elizondo | LLBLGen Support Team