Reputation: 6862
So I load one million nodes in Neo4j community db and try to retrieve 564343th node. It takes 31.568 secs. Does neo4j sucks that much or I am doing something wrong? I am using jruby with neo4j.rb gem.
irb(main):001:0> 1.upto(1000000) { |n| UserNode.create(user_id: n) }
irb(main):018:0* bm = Benchmark.measure do
irb(main):019:1* nx = UserNode.find(user_id: 564343)
irb(main):020:1> end
=> #<Benchmark::Tms:0x2836b45a @stime=0.7000000000000028, @real=31.567999839782715, @total=37.9700000000001, @cutime=0.0, @utime=37.270000000000095, @label="", @cstime=0.0>
irb(main):021:0> puts bm
37.270000 0.700000 37.970000 ( 31.568000)
=> nil
Upvotes: 1
Views: 490
Reputation: 33185
I'm not that familiar with neo4j.rb, but I have a feeling you're not using an index in your find, so it's needing to scan the entire db.
Upvotes: 2