The problem is that you try to create one node per tx, you should try to do
20-50k per tx.
Then it only takes a few seconds to create 1M nodes.
// values should be a list of 20-50k elements
> public void createNodes(String type, String key, List<String> values)
>
> {
> Label label = DynamicLabel.label(type);
> try (Transaction tx = graphDB.beginTx())
> {
for (String value : values) {
Node createdNode = graphDB.createNode(label);
>
> createdNode.setProperty(key, value);
> }
> tx.success();
> }
> }
Am 20.01.2014 um 00:31 schrieb frandro <[email protected]>:
> Dear all,
>
> I'm just testing much work how much Neo4j can endure.
>
> I'm planning to make 1 million nodes and relations more than the nodes.
>
> I coded a method that creates a node as following and a caller to it in a for
> loop to create nodes as many as specified in the for loop.
>
> The problem is that it takes 20~30 seconds to create 1,000 nodes. It'll take
> more than a day to create 1 million nodes.
>
> What's the problem? Is there another way to make it faster?
>
> public Node createNode(String type, String key, String value)
>
> {
> Node createdNode;
>
> try (Transaction tx = graphDB.beginTx())
> {
> createdNode = graphDB.createNode(DynamicLabel.label(type));
> createdNode.setProperty(key, value);
>
> tx.success();
> }
>
> return createdNode;
> }
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.