Memory doubt in java
Posted on 2012-03-18
I have a table which has around 67 columns.The scenario is such that i retreive the records of this table based on a certain condition and there are around 5 million records retreived.
So far from the 5 million records retreived only 15 columns have data in them.
I have to read each and every record and based on several computations and condtions in the 15 existing columns of data i need to fill the renaining values in these records.
Here i am loading data for several students and each student have several thousand data records.Here my doubt was do i procure all the 5 million rows by creating those many objects like say collections and update the rest of the columns for each of these rows one at a time at astretch or do i procure for each student and do it the same way for every student one a time.
My doubt is if i choose it to do 5 million rows at a stretch how do i ensure there is no memory shortage.
Can anyone suggest regarding the same and point out how this shoud be done and which is a better method.