0

I am new to neo4j.I need to extract first 5 million or any range of 5 million data with relationship from this 20 millions dataset.I have been struggling to run range query on my data. If I can extract the data and again import to neo4j it would be great luck for me.

these are the properties of my node - address,hash,time,nounce,public_key(all node doesn't contain same properties, some contain address, some hash,time etc)

just to let you know. if I do start n=node(*) return n; then looks like my computer goes to never ending sleep.

any help would be trully appreciated.

sky
  • 25
  • 5

1 Answers1

0

So you want it to return the any 5 million nodes? That's going to be a lot of data. The reason your computer keeps running forever when you run start n=node(*) return n; is because the system is usually attempting to cache everything, either that or trying to return all that data is too much for the system to parse and return. I don't believe there is a Cypher way of returning nodes 1-1,000,000 without having to put them all coma separated in the START clause.

Are you required to use Cypher? It would be fantastic if you could use the native Java API for this as it would all you to perform your processing there on each node, instead of returning them if they are not needed outside of a query.

One answer may be the following: START n=node(*) RETURN n ORDER BY n.property LIMIT 1

Nicholas
  • 7,403
  • 10
  • 48
  • 76
  • thank you @Nicholas for your reply.yes, I can use java API and as a matter of fact I have already accessing the DB using java API. But I still don't see any luck for range query (for example I want to run query on node id = 1 to node id = 1000000) as I will be running Cypher Query, is it right? please let me know where I am making mistake – sky Jul 13 '13 at 22:00
  • You can access the nodes without Cypher in Java, `db.findNodeById()`. What are you doing with these nodes? Do you need access to all at one time, or will it just be node-by-node processing. – Nicholas Jul 13 '13 at 22:49
  • I want to check who has received highest amount of money and what are transactions of a that highest received amount node. I need to access to all one time, in my understanding. – sky Jul 13 '13 at 23:53
  • So you don't really need to hold them all in memory, you just need to hold a the current highest number and pass through each node and if that node's number is higher than the highest, you want to save that node ID and that number, correct? – Nicholas Jul 14 '13 at 11:47
  • thank you @Nicholas for your help...java api is great help. I would still like to know how to do range query with cypher :) – sky Jul 15 '13 at 11:05
  • If you really want, you can do an `order by` and then a limit of N. See my edit to my answer. – Nicholas Jul 15 '13 at 12:01