# Strange result in comparison with neo4j

**URL:** <https://discuss.dgraph.io/t/strange-result-in-comparison-with-neo4j/5377>\
**Category:** Users\
**Created:** [November 7, 2019, 8:03am UTC](https://discuss.dgraph.io/t/strange-result-in-comparison-with-neo4j/5377 "2019-11-07T08:03:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehanizm](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mehanizm/32/2170_2.png) [@mehanizm](https://discuss.dgraph.io/u/mehanizm)\
**Post date:** [November 7, 2019, 8:03am UTC](https://discuss.dgraph.io/t/strange-result-in-comparison-with-neo4j/5377/1 "2019-11-07T08:03:51Z")

</div>

Hi everybody!

First of all, I like what you guys are doing in Dgraph! I’ve been following the progress for a year and I’m absolutely impressed.

I have a product that uses relational DB with a huge number of links inside and now I’m doing the research about graph databases whether they can help in some cases or not.

To do that I exported data sample and tried to bulk upload it to neo4j and dgraph.

**About the data**

I selected one type of entity:

```auto
type Individual {
  id Int
  name String
  surname String
  patronymic String
  dt DateTime
}

```

- I did not use the type in the dgraph scheme.

And three types of relations. Each relation type has four properties (facets in terms of Dgraph).

I exported 150M of Individuals and 50M of each type of relation.  
Schema in Dgraph was

```auto
<id>: int @index(int) .
<name>: string @index(trigram) .
<surname>: string @index(trigram) .
<patronymic>: string @index(trigram) .
<dt>: datetime .
<rel_1>: [uid] @reverse .
<rel_2>: [uid] .
<rel_3>: [uid] @reverse .

```

**About the server**

I used 16 Core and 64Gb RAM server with SSD disks.

**Dgraph upload results**

I used bulk loader as described here [https://blog.dgraph.io/post/bulkloader/](https://blog.dgraph.io/post/bulkloader/)

RDF examples:

```auto
_:individual.{{.ID}} <id> "{{.Hid}}"^^<xs:int> .
_:individual.{{.ID}} <dt> "{{.Dt}}"^^<xs:dateTime> .
_:individual.{{.ID}} <name> "{{.Name}}"^^<xs:string> .
_:individual.{{.ID}} <surname> "{{.Surname}}"^^<xs:string> .
_:individual.{{.ID}} <patronymic> "{{.Patronymic}}"^^<xs:string> .

```

and for eash type of relation

```auto
_:individual.{{.ID1}} <rel_1> _:individual.{{.ID2}} (prop1="{{.Prop1}}", prop1={{.Prop2}}, prop1={{.Prop3}}) .

```

Bulk loader finished in 2,5 hours and uploaded 900M of edges. There were a lot of fails with OOM, but with some tuning of the bulk loader params the process was finished properly.

**Neo4j upload results**

I used neo4j-admin bulk import from CSV files. There were four different csv files: one for the nodes and three for the each type of relation.

Neo4j loaded this amount of data in 6 minutes! In neo4j case _name_, _surname_, _patronymic_ and _dt_ were not edges, like in Dgraph, but the properties of the node. So the actually counts was: 150M nodes, 150M relations, 1,2B properties.

**Query perfomance results**

I used an analytic query to test and compare performance.  
Something like:

- find all nodes by the name and surname filter
- recurcive find all related (bidirectional) nodes with filter on edge properties (facets)
- return it

Dgraph result was 16 seconds (with indexes)  
Neo4j result was 88 seconds (without indexes).  
Neo4ji result was \<1second after proper indexes was built.

**Questions**

I think that I did something really wrong or do not understand how the Dgraph works. I do not believe that it is real results.

Could help me explain these results or guide me to the right way?

---

<div class="post-metadata">

**Author:** ![Shekar](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@Shekar](https://discuss.dgraph.io/u/Shekar)\
**Post date:** [November 8, 2019, 3:56pm UTC](https://discuss.dgraph.io/t/strange-result-in-comparison-with-neo4j/5377/2 "2019-11-08T15:56:08Z")

</div>

Hi,

Thank you for the post. We will look at it as a high priority item and respond with our observations and results promptly.

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [November 8, 2019, 6:21pm UTC](https://discuss.dgraph.io/t/strange-result-in-comparison-with-neo4j/5377/3 "2019-11-08T18:21:17Z")

</div>

Hi Mike Berezin, can you clarify some points?

I never used Neo4J for real, I just tested it a long, long time ago. So I’m a “newbie” in that DB.

It is very complicated to make a direct comparison of Dgraph with Neo4J. It seems to me that Neo4J is more CSV oriented, I was analyzing here how to use JSON imports and it seems that you need to do more treatments than usual to import JSON.

> [@mehanizm](#):
>
> I used neo4j-admin bulk import from CSV files.

Does this tool insert the data while the Neo4J Cluster is running or is it a preparation to create a cluster?  
This behavior would be equivalent to the [Bulkloader](https://docs.dgraph.io/deploy/#bulk-loader) we have. And this tool is extremely fast. The load of 21 million RDFs takes an average of 4 minutes with it.

This dataset you’re using is public? I intend to use the yelp dataset (it seems public to me) that the folks at Neo4J uses.

> [@mehanizm](#):
>
> Bulk loader finished in 2,5 hours and uploaded 900M of edges.

Are you sure it is bulkloader? What is the size in MB of this dataset?

> [@mehanizm](#):
>
> I used bulk loader as described here [Loading close to 1M edges/sec into Dgraph - Dgraph Blog](https://blog.dgraph.io/post/bulkloader/)

I skipped this part unintentionally

---

<div class="post-metadata">

**Author:** ![mehanizm](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/mehanizm/32/2170_2.png) [@mehanizm](https://discuss.dgraph.io/u/mehanizm)\
**Post date:** [November 22, 2019, 9:10am UTC](https://discuss.dgraph.io/t/strange-result-in-comparison-with-neo4j/5377/4 "2019-11-22T09:10:22Z")

</div>

Hi, Michel. Thanks for the answer.

Sorry for the long delay.

> Does this tool insert the data while the Neo4J Cluster is running or is it a preparation to create a cluster?

Yes, Neo4j admin tool works like Bulkoader – loads the data before the Neo4j server starts.

> The load of 21 million RDFs takes an average of 4 minutes with it.

It looks the same. I have 900M of rdfs and loaded this amount of data in 2,5 hours.  
4 min \* 900 million / 21 million = 2 hours 50 min

> Are you sure it is bulkloader? What is the size in MB of this dataset?

Yes, I’m sure. 5,5Gb in .gzip format.

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [November 22, 2019, 4:47pm UTC](https://discuss.dgraph.io/t/strange-result-in-comparison-with-neo4j/5377/5 "2019-11-22T16:47:45Z")

</div>

Hey Berezin,

We are working on it. We have a few engineers to get the bottom of this.  
We already have some progress in terms of Bulkloader. But we gonna push even further.

Cheers.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/2/2b38fdece2abe5814f2e51bee69d1e67fc304b0a.png) [@system](https://discuss.dgraph.io/u/system)\
**Post date:** [December 22, 2019, 4:47pm UTC](https://discuss.dgraph.io/t/strange-result-in-comparison-with-neo4j/5377/6 "2019-12-22T16:47:50Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
