ASP.NET and SQL server with huge data sets

Posted by Jake Petroules on Stack Overflow See other posts from Stack Overflow or by Jake Petroules
Published on 2010-12-26T05:51:56Z Indexed on 2010/12/26 5:54 UTC
Read the original article Hit count: 263

Filed under:
|
|

I am developing a web application in ASP.NET and on one page I am using a ListView with paging. As a test I populated the table it draws from with 6 million rows.

The table and a schema-bound view based off it have all the necessary indexes and executing the query in SQL Server Management Studio with SELECT TOP 5 returned in < 1 second as expected.

But on the ASP.NET page, with the same query, it seems to be selecting all 6 million rows without any limit. Shouldn't the paging control limit the query to return only N rows rather than the entire data set? How can I use these ASP.NET controls to handle huge data sets with millions of records? Does SELECT [columns] FROM [tablename] quite literally mean that for the ListView, and it doesn't actually inject a TOP <n> and does all the pagination at the application level rather than the database level?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql-server