hi!
aside the speed differences it is of course a question of sorting order.
this depends on the database or your sorting algorithm and/or locale 
specific rules.
if you want to use the database's sorting ability and you have large records
you could consider to send an "order by" statement with only the primary key
column
(only if you have one of course, preferrably a numerical key) and sort the
records in memory according to this.
I did not yet think of a good algorithm for matching the newly sorted key
column
with the one in memory, but this would reduce bandwidth because only one
key value per record has to be fetched from the database. if you try this
out
I would be curious if this really has any advantage, I did not try it myself
;o)
greets

> 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

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


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

Reply via email to