k kousalya wrote:I have to get all the records of account type "savings" and need to do some other operation on those records.
Now optimization is depends upon those "some other" operations also, fetching hundreds rows first, doing some operations on them, and showing them to user, will definitely improve the user experience as well as Java code execution.
As far as database is concerned, you need to have a proper indexing, so that data retrieval is fast.
k kousalya wrote: What i did was I created an ArrayList and store all the customer ids based on account type. and in if loop i am checking that the customer id is existed in that array list or not.It is working fine. But it is very slow.
Same here, no need to take all the Customer Ids in arraylist, take some rows at a time, also filtered out the required ids in the query itself which reduces the if conditions..
And welcome to JR
