1

I found out the hard way that if you design your import function in python to use a single transaction for each node it will be incredibly slow.

I have millions of nodes, and they have to be processed in the fastest way possible. Currently, I have a gremlin script that returns a set of nodes and edges in a generator. This is efficient, as it is transactional. However, whenever I iterate over the edges, I have to know what node to connect them to for my application;

What I need to know is if, for any edge, does inV or outV on an edge force a remote lookup?

Adam Miller
  • 1,756
  • 1
  • 25
  • 44

1 Answers1

2

Gremlin is the query language that runs inside the graph database server (think of it like SQL for graphs -- you can send the full query to the server each time, or you can store your Gremlin scripts on the server and execute them like stored procedures).

See this post on how to use server-side Gremlin scripts (stored procedures):

https://groups.google.com/d/topic/gremlin-users/Up3JQUwrq-A/discussion

If you're splitting your query up into multiple Bulbs requests, you're doing something wrong. Don't use Bulbs' built-in inV() and outV() for each query -- write a Gremlin script that does the full query for you (that's what Gremlin does -- it iterates over the graph in an efficient way, inside the graph database).

See this example for how to use custom Gremlin scripts in Bulbs (you can use this technique for transactional requests and queries):

Is there a equivalent to commit in bulbs framework for neo4j

NOTE: The above example doesn't use server-side scripts -- it's sending the script to the server each time; however, you probably want to store the script on the server in production.

Community
  • 1
  • 1
espeed
  • 4,754
  • 2
  • 39
  • 51
  • ah ok, so I need a way to know the edges that are between what nodes. To do that, I currently return the edges, but in order to be able to link them, I must use inV and outV on the edges. Is there a way that I can return edges and not use inV and outV to know what nodes an edge is connected to? – Adam Miller Apr 24 '14 at 18:45