I have a table with 15 columns and 6.5 MILLION records. I need to access this table from the C# side with help of paging. I have written an SP but it takes about 1.30 mins to retrieve the data. here's my Stored Proc -
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
Does anyone knows a way of making this run faster.