Q: efficient way to check the number of records in a large dabase with JE -
10-31-2005
, 01:59 PM
Hi, there
I am starting to use berkeley db java edition for testing datamining
algorithm on a large dataset. I found it very slow to check the number
of records in my database using the cursor:
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
Cursor cursor = database.openCursor(null, null);
while(cursor.getNext(key, data, LockMode.DEFAULT) ==
OperationStatus.SUCCESS)
count++;
cursor.close();
return count;
Could anybody tell me an efficient method to get it? BTW, there are
about 8 million records in the database and take about 60G database. I
used linux with 4G memory. I use the java -server -Xms2000m -Xmx200m
when running.
Thanks a lot
Tong |