I use the PagedList class in my web application, and many of you may be familiar with what you were doing with ASP.NET MVC and LINQ to SQL. This was reported by Rob Conery , and a similar incarnation was included in things like Nerd Dinner , etc. It works great, but my database administrator expressed concern about possible future performance issues.
Its problem is related to SELECT COUNT (*), which is returned as a result of this line:
TotalCount = source.Count();
Any action that has paged data will trigger an additional query (for example, below) as a result of calling the IQueryable.Count () method:
SELECT COUNT(*) AS [value] FROM [dbo].[Products] AS [t0]
Is there a better way to handle this? I examined the use of the Count property of the PagedList class to get the number of elements, but realized that this would not work because it counts the number of elements currently being displayed (and not the total number).
How much of the performance will be the cause of my application when there is a lot of data in the database?
performance asp.net-mvc linq-to-sql pagination
Ryan ivest
source share