dbTalk Databases Forums  

Q: efficient way to check the number of records in a large dabase with JE

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Q: efficient way to check the number of records in a large dabase with JE in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dataminer
 
Posts: n/a

Default 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


Reply With Quote
  #2  
Old   
Ron
 
Posts: n/a

Default Re: Q: efficient way to check the number of records in a large dabase with JE - 10-31-2005 , 04:15 PM






Here is a technical tip which should help:

http://www.sleepycat.com/newsletters...10_count.shtml

Ron


Reply With Quote
  #3  
Old   
dataminer
 
Posts: n/a

Default Re: Q: efficient way to check the number of records in a large dabase with JE - 11-01-2005 , 12:11 PM



Ron,

Thanks for your timely response. I tried the last approach by geting
the BTreeStats. The program has been running for 15 hours waiting for
the return of Database.getStats() and it is still running there.

Also, iterating through all the records using the cursor is even slower
than MySQL. I guess the reason could be the database (65G, 8miilion
records) was built by many add and delete operations. And the log files
didn't physically delete the records and it affects the iterating
speed.

Tong


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.