1
votes

I've have a query for search elements similar to another, using tag concepts:

START similar=node:TYPE_INDEX("type1"), to=node(20325) 
match similar-[:TAGGED]->tag<-[:TAGGED]-to
return distinct similar, count(tag)
order by count(tag) DESC

"similar" is a set of node that are indexed using the type property. "To" is the node that I have to compare with "similar" nodes.

The similar query itself returns 500 nodes, and the count of relations TAGGED is 3000. Tag nodes are 500. On my machine this query takes 50secs.

Remove the order by clause and/or count clause not improve performance.

1
Could you by chance provide your test database or data generator, I would like to have a look at it and profile it? - Michael Hunger

1 Answers

0
votes

Which version of Neo4j are you using? How do you execute the query (REST, web-console, shell, java)? Is this the first run in the session or the second or third?

Can you try to rewrite your match clause, so that to comes first? It shouldn't make a difference but would be interesting to know.

match to-[:TAGGED]->tag<-[:TAGGED]-similar

Thanks a lot.