Killergo's Column
Recently, because of a bit of free time, I thought about how to use the paging of stored procedures on the SQL Server platform, now listed below.
In the actual test, the performance of the two is roughly equal in the case of 15,000 data, and the former is obviously better than the latter in the case of 20000-30000 data. The larger amount of data has not been tested.
Note that there are keys and indexes in the datasheet that have a significant impact on performance
-----------------------------------------------------
First type:
/* The first parameter is the number of pages per page, the second parameter is the target page number * *
CREATE proc sp_fixpage @pagesize int, @destpage int as
SET NOCOUNT ON
DECLARE @id int
DECLARE @startid int
Select @startid = (@destpage-1) * @pagesize
SET ROWCOUNT @startid
Select @id = ID from T_member
SET ROWCOUNT @pagesize
SET NOCOUNT OFF
SELECT * from T_member where ID > @id ORDER by ID
Go
The second type:
CREATE PROCEDURE sp_fixpage1 @pagesize int, @destpage int
As
SET NOCOUNT ON
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.