I have a large table having millions of records. I am binding this table to gridview in my application. Since data is large, we are retrieving data using paging concepts. like if i set the gridview page size to 2000, then i am fetching only 2000 records from table. i am using following Query for this
Select * from (select *, Row_Number() over (order by id) as Row_Index) a
where
Row_Index > @start_index and Row_Index < @End_Index
This query run fast for first few millions of records but as the start and end index increases performace degrades drastically. How can i improve this query
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…