Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««34567

SQL Server 2005 Paging – The Holy Grail Expand / Collapse
Author
Message
Posted Tuesday, December 07, 2010 2:50 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, May 10, 2013 10:03 AM
Points: 287, Visits: 1,900
SwePeso (12/6/2010)
It seems the dual TOP/ORDER BY was the most efficient approach by the time.
I tested the new Denali OFFSET/FETCH and I got the exact same number of reads for @StartRow = 5000, but 2 ms instead of 4 ms.

SELECT		Number
FROM dbo.TallyNumbers
ORDER BY Number
OFFSET @StartRow - 1 ROWS
FETCH NEXT 50 ROWS ONLY


This is unreleased SQL Server 2011 functionality only, right?
Post #1031092
Posted Tuesday, December 07, 2010 3:27 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Friday, May 10, 2013 4:07 PM
Points: 1,943, Visits: 8,227
SwePeso (12/6/2010)
It seems the dual TOP/ORDER BY was the most efficient approach by the time.
I tested the new Denali OFFSET/FETCH and I got the exact same number of reads for @StartRow = 5000, but 2 ms instead of 4 ms.

SELECT		Number
FROM dbo.TallyNumbers
ORDER BY Number
OFFSET @StartRow - 1 ROWS
FETCH NEXT 50 ROWS ONLY



My take on the Denali paging....

http://sqlblogcasts.com/blogs/sqlandthelike/archive/2010/11/10/denali-paging-is-it-win-win.aspx

and

http://sqlblogcasts.com/blogs/sqlandthelike/archive/2010/11/19/denali-paging-key-seek-lookups.aspx




Clear Sky SQL
My Blog
Kent user group
Post #1031105
Posted Monday, November 07, 2011 11:45 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 08, 2011 2:28 AM
Points: 1, Visits: 2
This is good. But i wanted to ask, what about the situation in which, say there are only 5 records in the table, and you ask for page number 2 with page size 10?
In that case there is no data returned to you, and you will not get to know how many records are there, in the table.
Post #1201817
« Prev Topic | Next Topic »

Add to briefcase «««34567

Permissions Expand / Collapse