Adding a bunch of Vertices and edges takes for ever

Skip to first unread message

Sep 11, 2017, 4:03:07 AM9/11/17
to JanusGraph users
I am writing an app that loads an existing RDBMS based graph implementation into JanusGraph.

I create this index:

        JanusGraphManagement mgmt = javaGraph.openManagement();
        if (mgmt.containsPropertyKey("nodeId")) {
            nodeId = mgmt.getPropertyKey("nodeId");
        } else {
            nodeId = mgmt.makePropertyKey("nodeId").dataType(Integer.class).make();

            JanusGraphManagement.IndexBuilder nodeIdIndexBuilder = mgmt.buildIndex("nodeIdInd", Vertex.class).addKey(nodeId);
            JanusGraphIndex nodeIdIdx = nodeIdIndexBuilder.buildCompositeIndex();


Creating the vertices and edges (~6K vertices and ~40K edges) takes a very long time.

Am I missing something?

Sep 11, 2017, 4:06:40 AM9/11/17
to JanusGraph users
I should add I do this query (to eliminate duplicate vertices) before adding each Vertex as I know that in the existing RDBMS same nodes exist multiple times:

javaGraph.traversal().V().hasLabel(instanceId).has("nodeId", nodeInfo.getId());

        if (vertexNode.hasNext()) {
        } else {
            JanusGraphVertex node = javaGraph.addVertex(instanceId/*,,((Integer)id).longValue()*/);
  "nodeId", id);
            return node;

Do I need to index the label as well?

Any other ideas?

Ankur Goel

Sep 11, 2017, 9:34:39 AM9/11/17
to JanusGraph users
You are using unique(), this takes lock for each operation. Try to handle uniqueness through application instead of Janus.


Yair Ogen

Sep 12, 2017, 2:31:29 AM9/12/17
to Ankur Goel, JanusGraph users
good to know. Thanks

You received this message because you are subscribed to a topic in the Google Groups "JanusGraph users" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
To view this discussion on the web visit

For more options, visit

Reply all
Reply to author
0 new messages