hi.. I'm in delima what could be a better approach for pagination in a web - based application : it is get data into the memory for onceonly and try manage the things here only ( don't know if it can be done in general ways but if done ... IT INVOLVS MEMORY OCCUPIED , it can go serious if records are in huge number like google search results )
Fetch some n number of records each time and display them ( IT INVOLVS LOTs of CALLS TO DB )
Funny you should mention Google: their policy is to never display more than 1,000 links for a query. Sure, they tell you that there were 2,870,000 hits but they won't show you more than the first 1,000. You might consider copying that idea. Then you just have to read the first 1,000 rows into memory, and your concerns about many calls to the database go away.
Of course this assumes you show the records that are the most important to the user first, like Google does. But you are already doing that, aren't you? You wouldn't make the user click through 20,000 pages in a web application, right?
Originally posted by stu derby: Google also doesn't use a relational database for their search engine.
Perhaps not. But if they had to be prepared to materialize all 2-million pages that matched my search, they would have the same problem as Naveen does. The point is that showing data one page at a time and having millions of rows of that data are features that should not coexist in the same design.
Joined: Nov 20, 2005
Hi. Thanks Paul and Stu for your precious comments on the issue . I think , I could procceed with Paul's hybrid approach of fetching some good number of records in the memory and play arround with it until user goes beyond those records .It reduces both calls to DB and need of memory to keep huge amount of data.