Database query vs java processing

algorithm, database, java, processing-efficiency, sql

Solution

Database dips are always an expensive operation. If you can manage with one db fetch and do some java processing, it should be a better and faster choice for you.

But you may have to analyze in your scenarion, which one is turning to be a more efficent choice. I assume singly DB fetch and java processing should be better.

Problem

Is it better to make two database calls or one database call with some java processing? One database call gets only the relevant data which is to be separated into two different list which requires few lines of java.

Original source