db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yves pielusenet <yvespieluse...@free.fr>
Subject Iterate over big table...
Date Fri, 19 May 2006 13:25:58 GMT
Hello,
I have such a table :
CREATE TABLE data (
   numvign INTEGER PRIMARY KEY,
   data BLOB NOT NULL
)

This table should have millions of records. I have to iterate over all
records.
What is the best way (I don't want to have a outOfMemoryException) :

for(int i=0; i<nbRows; i++){
    theData = select data from data where numvign=i;
    doSomething(theData);
}

or :

alldata = select data from data order by numvign;
while(alldata.hasNext()){
   doSomething(allData.next());
}

When I do a big select, are all selected rows into memory or derby
access to database when it necessary ?

thanks :)

-- 
yves piel


Mime
View raw message