Greetings,

I have always used an 'order by' to do the sorting as I felt it was easier
to do it that way... Also depending on how the DBMS implements caching the
next time you fire off the query with a different 'order by' it will pick
up the same result set in memory from the previous query providing that
nothing else has changed in the rest of the SQL statement. I found it to be
quite quick using Oracle. Besides that's what a database does best is sort
records. You could probably do it by caching the result set using Value
objects in a Collection but I have never done it that way so I don't know
if there would be a performance advantage or not. It would certainly use
quite a bit of the Java heap so be prepared to increase the memory
requirements when you start the JVM.

HTH,
Greg.





"Repine, Burt" <[EMAIL PROTECTED]> on 2002/05/29 06:01:58 PM

Please respond to "JDJList" <[EMAIL PROTECTED]>

To:   "JDJList" <[EMAIL PROTECTED]>
cc:

Subject:  [jdjlist] sorting records


Hello all -

I have a requirement to retrieve n number of records from a database using
JDBC and then display those records to the user.
The user can then sort those records if they so choose.
Would it be faster/less resource intensive to go back to the database with
a
new 'order by' SQL statement OR sort the records as a Collection in the
Java
code?

Thanks for the help,
Burt



To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm







To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to