Tried using official GO driver - Poor performance


I'm new to Neo4j and I've been playing around with the whole platform. Lately, I've been experimenting with interacting with the DB from a Go program.
To do this, I rewrote this GO code goneo-example using neo4j-go-driver .

For the merge function, I did this

func merge(absoluteURL string, depth int, neo4jDriver neo4j.Driver) error {
	var (
		neo4jSession neo4j.Session
		err          error

	if neo4jSession, err = neo4jDriver.Session(neo4j.AccessModeWrite); err != nil {
		return err
	defer neo4jSession.Close()

	_, err = neo4jSession.Run("MERGE (p: page {url: $url, depth: $depth}) RETURN p", map[string]interface{}{
		"url":   absoluteURL,
		"depth": depth,

	//_, err = neo4jSession.Run("CREATE ()", nil)) // Also poor perfomance

	return err

But I'm getting weaker performance (also with CREATE () ).
In the documentation it says:

The driver is thread-safe, while the session or the transaction is not thread-safe.
It is considerably cheap to create new sessions and transactions.

I don't understand why I have poor performance.

Do you have an index or node key for :Page(url, depth) ?

for example:
CREATE CONSTRAINT ON ( page:page ) ASSERT (page.url, page.depth) IS NODE KEY;

None of that. Start with empty Neo4j database. Performance is quite acceptable with golang-neo4j-bolt-driver

Check out the newer version here, blog posts and examples are coming soon:

Yes please follow Eve's advice and add an constraint for :page(url) if that's unique by URL.

I successfully use johnnadratowski/golang-neo4j-bolt-driver. What's your fork?

According to your indications, this constraint must be added before any cypher order merge or create.


Is that right?

IS UNIQUE is enough there, NODE KEY is for composite indexes.

you can add constraints any time, they just might fail if you have duplicates

the improved fork is this one:

OK. Thank for your help.
Can you tell me how this fork is improved?