I've been experimenting with OrientDB 2.0 with Node (via Oriento). I'm
using the following code to iterate over a class with hundreds of thousands
of records:
var db = server.use({
name: 'MyDB',
username: 'admin',
password: 'admin'
});
db.class.get('MyTable')
.then(function (MyClass) {
walkList(MyClass, 0);
});
function walkList(MyClass, offset) {
MyClass.list(500, offset)
.then(function (records) {
if(records.length > 0) {
console.log('Progress: ' + offset + ' - adding ' + records.length);
offset += records.length;
walkList(MyClass, offset);
} else {
console.log('done');
}
});
}
The main problem with the technique is it begins to slow down very quickly.
Behind the scene Oriento is building a LIMIT / OFFSET query and the
further into the dataset it needs to seek the longer it takes. Other
database engines / drivers offer fire hose cursors for this type of thing.
Have I overlooked a better solution?
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.