I did not intend to get into a debate, If I miss read his question, I am
sorry.
Just want to clarify what I mean in my previous email.
I thought he wanted to return 100-200 records, not necessary
mean the table only has 100-200 records,
>I have a sql query that joins 5 or 6 tables that
>returns 100 to 200 records.
If he means that whole tables only have 100-200 records, then there is no
need to read further, Client sorting is fine. If tables do have more than
200 records, then read on.
Let suppose the table has 10,000 records (actually could just be 300
records),and he want to return 200 records sorted by a Date; After that, he
decided to sort the records by name, still display 200 records.
If we use client side sorting, the result would be sort 200 records by name
(client side) after sorted by date ( in datebase). This may or may not be
what he wants.
If the business requirement is to sort the EXISTING records, then client
side sorting is still fine.
but if the business requirement is sorting the records by name, and display
the first 200 records, then client side sorting may not display the correct
records, as some of the first 200 records (if sorted by name) are still in
database. In this case, one have to sort by database.
Chester
> -----Original Message-----
> From: Tim Wood [mailto:timwood0@(protected)]
> Sent: Wednesday, September 24, 2003 1:27 PM
> To: A mailing list for Java(tm) 2 Platform, Enterprise Edition
> Cc: chester.chen@(protected)
> Subject: Re: sorting query results in J2EE
>
>
> At 12:20 PM 09/24/03, you wrote:
> >unless you returned the WHOLE list from the query,
> >otherwise, sorting on client side will result in incorrect dispaly.
> >
> >And in many cases, it's impossible to bring the WHOLE list
> to client side
> >as the list is too large.
>
> True in general; in this case, 100-200 records is not onerous.
>
> >Also, sorting at client side may also cause memory usage to
> go up when the
> >list is large.
>
> True in general, however this data set is not large, and
> there's lots of MIPS and RAM on clients these days.
>
> >Just let the database do the sorting and return the sub-set
> of list you care
> >back to clients.
>
> If there's a cheap way to offload "what-if" processing from a
> production database, it's a good idea.
>
> TW
>
===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".