File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes Which sorting is better, Code Level Vs Database level? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Which sorting is better, Code Level Vs Database level?" Watch "Which sorting is better, Code Level Vs Database level?" New topic
Author

Which sorting is better, Code Level Vs Database level?

Bhairava Surya
Ranch Hand

Joined: Aug 19, 2007
Posts: 45
Hi All,

I have one basic query, which sorting is better whether code level sorting or database(sql) level sorting?

Thanks & Regards,
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11313
    
  16

almost every 'what is better...' question in software is answered with "it depends". what do you mean by "better" - speed? memory usage? simplicity to code/develop? cost?

Is the data already IN a database?

There are too many variables to give a blanket answer that will ALWAYS be true.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4657
    
    5

Fred is right.

It also depends on your overall architecture. If you have a giant, fast, DBMS server and fairly lightweight applications talking to it, it may be faster to use the DBMS to do the sort.

And it depends on how many things you are sorting.

Other than a fun topic to argue over beers, you need a lot more specifics to get any useful information or guidance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which sorting is better, Code Level Vs Database level?