-
Notifications
You must be signed in to change notification settings - Fork 276
Batch insert
The Neo4j batch inserter Java API is not wrapped in a Ruby API (it was supported in 1.x version of neo4j.rb).
I would suggest first try without the batch inserter api and make sure you only commit after each 1000-3000 write operation.
Here is an helper class https://gist.github.com/4516914.
Example of usage
t = TransactionalExec.new(1000) do |data|
Neo4j::Node.new(data) # or use your model classes (the Neo4j::Rails::Model) which might be slower
end
t.execute([{:name => 'a'}, {:name => 'b'}]
If you want to use the neo4j gem but insert using the neo4j-core API (because of speed) you must make
sure you set the _classname
property and create relationships from the Neo4j.ref_node
to class node and from the class not relationship _all
to all instances.
If you still have performance problem, I would suggest using the Java Batch api directly, see https://github.com/andreasronge/neo4j-perf for examples
WARNING: Much of the information in this wiki is out of date. We are in the process of moving things to readthedocs
- Project Introduction
- Neo4j::ActiveNode
- Neo4j::ActiveRel
- Search and Scope
- Validation, Uniqueness, and Case Sensitivity
- Indexing VS Legacy Indexing
- Optimized Methods
- Inheritance
- Core: Nodes & Rels
- Introduction
- Persistence
- Find : Lucene
- Relationships
- Third Party Gems & extensions
- Scaffolding & Generators
- HA Cluster