Count with paging

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 24-May-2005 15:45:45   

Hi,

Would it be possible for FetchEntityCollection to return the total record count when paging from the temp table used to do the paging? (At least, for SQL Server.)

This would avoid a trip to the database plus a second filtering of the items in the collection as a result of calling 'GetDbCount' and would also guarantee that the total count is consistent with the results actually returned from the query.

Ian.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 24-May-2005 17:00:09   

That's not possible, as the paging routine only stores pageno+1 * pagesize rows in the temp table, because more rows are never required. If the count has to be calculated, all rows have to be read for the COUNT(*), each time the query is ran, which is IMHO slower, especially on very large resultsets.

Frans Bouma | Lead developer LLBLGen Pro