ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: PaginatedList question
Date Thu, 30 Jun 2005 03:50:29 GMT
Hi Aladin,

PaginatedList is meant for simple systems that have the luxury of keeping a 
page of data around in memory. In a high performance system that needs to 
scale, keeping even a page of records in memory is a bad idea...regardless 
of PaginatedList. Even 25 records per page could be devastating in a system 
with 10,000 concurrent sessions (in fact session management in general could 
be an issue at that point). So you're much better off just storing a) the 
current page and b) the page size --basically 2 that in total use up less 
memory than a single PaginatedList page...

PS: Doing a binary search is a) way slower and b) way more work than just 
doing count(1).

Cheers,
Clinton

On 6/28/05, ibatis@aladin.ca <ibatis@aladin.ca> wrote:
> 
> Hi Clinton,
> 
> I'm interested in knowing why you would discourage the use of the
> paginated list in a "high performance" system?
> 
> In response to another post...
> 
> In order to compute the number of pages (using the paginatedlist), a
> simple binary search method can be applied once when the result is first
> queried. This binary search finds the last page in the set; reducing the
> set by half on every iteration (hence binary). Of course, some critical
> assumptions have to be made. The end result is something very similar to
> google, where it tells you that your search yielded n pages with m
> records... but when you click on the last page, those numbers are
> re-adjusted. I hope this makes sense to you...
> 
> Nevertheless, I am more interested in why the use of the paginated list is
> discouraged.
> 
> Thanks.
> Aladin
> 
> > The documentation is mistaken. Previous() should not wrap for the
> > paginated
> > list. Regardless, you shouldn't use that approach to calculate the 
> number
> > of
> > pages, you should use a separate count(*) query and divide by page size.
> >
> > For high performance systems, you should not use paginated list at
> > all....you should use queryForList with skip and count parameters.
> >
> > Clinton
> >
> >
> > On 6/27/05, ibatis@aladin.ca <ibatis@aladin.ca> wrote:
> >>
> >> Hello,
> >>
> >> I seem to be having some problem with the PaginatedList.
> >>
> >> When I'm on the first page and I do paginatedList.getPreviousPage(),
> >> iBatis doesn't wrap to the last page... as specified in the javadoc. I
> >> need this wrapping functionality to compute the total number of pages 
> in
> >> the result set.
> >>
> >> Does anyone have any idea as to why this might be happening?
> >>
> >> I am using postgres with jdb3.
> >>
> >> Thanks.
> >> Aladin
> >>
> >
> 
>

Mime
View raw message