You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Licco <hk...@gmail.com> on 2008/11/29 09:08:23 UTC

Pagination Questions

Dear All,
I am currently working on pagination to the result of search result. I  
want to ask which solution is better?
1. After user chooses some criterias and then clicks the search  
button, the server will return the size of search result and the  
objects of first page of the search result. Then when user clicks the  
different page number, the server will get the data for that page from  
DB. But for this solution, it requires DB access when you click the  
page number.

2.After user clicks the search button, the server will get all the  
objects(like all the films which the user wanna.). Then when user  
clicks different page number, the server will just return the data  
from memory. This seems to reduce the DB access times.

3. Use some preload method to store the data for the next few pages in  
a buffer.

Which solution will achieve a fast search and reduce the access load  
to the DB?

Thanks a lot for your feedback!

Li, Ke (Licco)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Pagination Questions

Posted by Martin Gainty <mg...@hotmail.com>.
I agreeunless absolutely necessary caching data from the DB guarantees your data will be inconsistent with your last DB snapshot
If you're running out of cursors use the right cursor SELECT instead of updateIf you're running out of connections use connection-pools...there are plenty avaialble for any DB implementation
 
Dave?Martin ______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > Date: Mon, 1 Dec 2008 09:40:50 +0800> From: hkustlicco@gmail.com> To: user@struts.apache.org> Subject: Re: Pagination Questions> > Hi Adam,> Thanks for your reply. I am doing pagination like this now since I found> that using index to do searching from a range of record is quite fast, much> faster than I thought before. So I just use your suggested solution.> > > 2008/11/30 Adam Ruggles <a....@gmail.com>> > >> > Personally I think it would be a bad idea to buffer the data from the db,> > since most users when performing a search will only look at the first page> > of results. It would be better to simply return a limited set of results> > from the DB. Otherwise you might be fetching data the user will never see.> >> > What I usually do is create an object that stores a list of the current> > result set and the total number of results. This object I create in the> > data layer and requires two db calls. One to get a limited list of results> > and the second to get the total item count.> >> > In the action I have an offset and resultsPerPage variable that I pass to> > my> > data layer. I don't know what database you're using but most allow you to> > limit the results, using an offset and number of results.> >> >> > KE LI-2 wrote:> > >> > > Dear All,> > > I am currently working on pagination to the result of search result. I> > > want to ask which solution is better?> > > 1. After user chooses some criterias and then clicks the search> > > button, the server will return the size of search result and the> > > objects of first page of the search result. Then when user clicks the> > > different page number, the server will get the data for that page from> > > DB. But for this solution, it requires DB access when you click the> > > page number.> > >> > > 2.After user clicks the search button, the server will get all the> > > objects(like all the films which the user wanna.). Then when user> > > clicks different page number, the server will just return the data> > > from memory. This seems to reduce the DB access times.> > >> > > 3. Use some preload method to store the data for the next few pages in> > > a buffer.> > >> > > Which solution will achieve a fast search and reduce the access load> > > to the DB?> > >> > > Thanks a lot for your feedback!> > >> > > Li, Ke (Licco)> > >> > > ---------------------------------------------------------------------> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org> > > For additional commands, e-mail: user-help@struts.apache.org> > >> > >> > >> >> > --> > View this message in context:> > http://www.nabble.com/Pagination-Questions-tp20744884p20749894.html> > Sent from the Struts - User mailing list archive at Nabble.com.> >> >> > ---------------------------------------------------------------------> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org> > For additional commands, e-mail: user-help@struts.apache.org> >> >> > > -- > Best Regards,> Licco
_________________________________________________________________
Access your email online and on the go with Windows Live Hotmail.
http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_access_112008

Re: Pagination Questions

Posted by KE LI <hk...@gmail.com>.
Hi Adam,
  Thanks for your reply. I am doing pagination like this now since I found
that using index to do searching from a range of record is quite fast, much
faster than I thought before. So I just use your suggested solution.


2008/11/30 Adam Ruggles <a....@gmail.com>

>
> Personally I think it would be a bad idea to buffer the data from the db,
> since most users when performing a search will only look at the first page
> of results.  It would be better to simply return a limited set of results
> from the DB.  Otherwise you might be fetching data the user will never see.
>
> What I usually do is create an object that stores a list of the current
> result set and the total number of results.  This object I create in the
> data layer and requires two db calls.  One to get a limited list of results
> and the second to get the total item count.
>
> In the action I have an offset and resultsPerPage variable that I pass to
> my
> data layer.  I don't know what database you're using but most allow you to
> limit the results, using an offset and number of results.
>
>
> KE LI-2 wrote:
> >
> > Dear All,
> > I am currently working on pagination to the result of search result. I
> > want to ask which solution is better?
> > 1. After user chooses some criterias and then clicks the search
> > button, the server will return the size of search result and the
> > objects of first page of the search result. Then when user clicks the
> > different page number, the server will get the data for that page from
> > DB. But for this solution, it requires DB access when you click the
> > page number.
> >
> > 2.After user clicks the search button, the server will get all the
> > objects(like all the films which the user wanna.). Then when user
> > clicks different page number, the server will just return the data
> > from memory. This seems to reduce the DB access times.
> >
> > 3. Use some preload method to store the data for the next few pages in
> > a buffer.
> >
> > Which solution will achieve a fast search and reduce the access load
> > to the DB?
> >
> > Thanks a lot for your feedback!
> >
> > Li, Ke (Licco)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Pagination-Questions-tp20744884p20749894.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Best Regards,
Licco

Re: Pagination Questions

Posted by Adam Ruggles <a....@gmail.com>.
Personally I think it would be a bad idea to buffer the data from the db,
since most users when performing a search will only look at the first page
of results.  It would be better to simply return a limited set of results
from the DB.  Otherwise you might be fetching data the user will never see.

What I usually do is create an object that stores a list of the current
result set and the total number of results.  This object I create in the
data layer and requires two db calls.  One to get a limited list of results
and the second to get the total item count.

In the action I have an offset and resultsPerPage variable that I pass to my
data layer.  I don't know what database you're using but most allow you to
limit the results, using an offset and number of results.


KE LI-2 wrote:
> 
> Dear All,
> I am currently working on pagination to the result of search result. I  
> want to ask which solution is better?
> 1. After user chooses some criterias and then clicks the search  
> button, the server will return the size of search result and the  
> objects of first page of the search result. Then when user clicks the  
> different page number, the server will get the data for that page from  
> DB. But for this solution, it requires DB access when you click the  
> page number.
> 
> 2.After user clicks the search button, the server will get all the  
> objects(like all the films which the user wanna.). Then when user  
> clicks different page number, the server will just return the data  
> from memory. This seems to reduce the DB access times.
> 
> 3. Use some preload method to store the data for the next few pages in  
> a buffer.
> 
> Which solution will achieve a fast search and reduce the access load  
> to the DB?
> 
> Thanks a lot for your feedback!
> 
> Li, Ke (Licco)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Pagination-Questions-tp20744884p20749894.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org