Forum


11:53

02/07/2009

Hi folks!
I'm working on a very large scale ASP.NET business application, which has hundreds of grids. I'm comfortable using jqGrid, but here is a critical problem. Since our client's database tables has millions of records, in our search query, we cannot say "select count(*) from table", as count(*) has a negative impact on performance. This is a strict "no". But without fetching count of total rows, grid's pagination will not work. The logic for enabling/disabling the "next" and "previous" buttons is tightly coupled with count of total rows inside grid.base.js file.
Can anyone suggest what should be done in my case? How about adding a toolbar with custom pagination? I'm not sure if that takes lot of effort. Please provide your valuable suggestions.
Regards,
Krishna,
12:01

Moderators
08/10/2009

Hello,
Unfortunately there is absolutely no way to do paging without getting the total row count -- how exactly would you know then how many records/pages you have and generate the proper pager data?
Still, I am not quote sure why you find the count(*) query to be slow. In fact, this is exactly how LinqDataSource does paging automatically - internally it always generates two queries -- one for the row count and one for the actual records. This works quite well even for millions of rows of data.
For more information, please refer to this example (1,000,000 rows with custom SQL)
http://www.trirand.net/example.....fault.aspx
and you can check out the performance section of the jqGrid help here:
Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller
09:24

02/07/2009

Thanks a lot Rumen!
Actually, I thought of writing custom pagination to avoid count(*)..logic is to just fetch one extra record on "next" click and disable "next" button when there are no more records. This doesn't require count, but needs lot of tweaking in grid.base.js. The demo which you showed is very convincing and clean. Will follow the same way as in the demo. Thank you once again for the quick reply! 🙂
Most Users Ever Online: 715
Currently Online:
54 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66