Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
jqGrid pagination without count(*) in sql procedure.
23/11/2009
11:53
Avatar
novogeek
Hyderabad, Andhra Pradesh
Member
Members
Forum Posts: 10
Member Since:
02/07/2009
sp_UserOfflineSmall Offline

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,

http://www.novogeek.com

23/11/2009
12:01
Avatar
Rumen[Trirand]
Moderator
Members

Moderators
Forum Posts: 81
Member Since:
08/10/2009
sp_UserOfflineSmall Offline

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:

http://www.trirand.net/documen.....ation.aspx

Trirand ASP.NET WebForms & MVC components based on jQuery & ThemeRoller

http://www.trirand.net

24/11/2009
09:24
Avatar
novogeek
Hyderabad, Andhra Pradesh
Member
Members
Forum Posts: 10
Member Since:
02/07/2009
sp_UserOfflineSmall Offline

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! 🙂

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information