I’m trying to select more than 80,000 record in SQL Server in a table that has millions of records. The issue is that I’ve the correct Index, but it takes more than 15 minutes to return the recordset.
I’m using MS SQL Server 2000, I found a pagination method using stored procedures but it uses a temporal table that I have to insert the entire Result Set and then select the quantity of record I’m going to show per page. This method takes too long.
Any help for a faster way that I can implement ?
You’ll have to edit this to implement your input parameters for user’s filtering and sort options, but the general principle will apply.. I used this technique with SQL 2000 in 2000/2001 timeframe with 90M record table to deliver fast paging for 150-200k row resultsets. Since only the key is in the temp table, it is a very narrow, very small temp tabl;e, and performance is fast, (and it only has to read the main table index, not the table itself, for this step) Then, when actually generating data from main table for actual (smaller) return resultset (only @PageSize rows) the query only has to read a very few records…