我有一个包含 15 列和 650 万条记录的表。我需要在分页的帮助下从 C# 端访问此表。我已经编写了一个 SP,但检索数据大约需要 1.30 分钟。这是我的存储过程-
Create Proc demo
(
@startRowIndex int,
@maximumRows int
)
AS
DECLARE @first_id int, @startRow int
SET @startRowIndex = (@startRowIndex - 1) * @maximumRows
IF @startRowIndex = 0
SET @startRowIndex = 1
SET ROWCOUNT @startRowIndex
SELECT @first_id = RecordID FROM edd_business_listings_05282009 ORDER BY RecordID
PRINT @first_id
SET ROWCOUNT @maximumRows
SELECT * FROM edd_business_listings_05282009 WHERE
RecordID >= @first_id
ORDER BY RecordID
SET ROWCOUNT 0
有谁知道让这个运行更快的方法。