Hi,

can you share your output of :schema in the browser?

if you don't have it do:

create constraint on (p:LABEL_TYPE_Project) assert p.id is unique;
create constraint on (m:LABEL_TYPE_PermissionNode) assert m.id is unique;

As in Neo4j you can always traverse relationships in both directions, you don't 
need the inverse relationships, it only hurts performance because queries then 
tend to check one cycle more.


You don't need variable length paths [*1] in your query, change it to:

> MATCH (n:LABEL_TYPE_Project 
> {id:'14'})-[:RELATIONSHIP_scopes]->(m:LABEL_TYPE_PermissionNode)-[:RELATIONSHIP_observedBy]->(o:LABEL_TYPE_Item)
> WHERE m.id in ['1', '2', '6', '12', '12064', '19614', '19742', '19863', 
> '21453', '21454', '21457', '21657', '21658', '31123', '31127', '31130', 
> '47691', '55603', '55650', '56026', '56028', '56029', '56050', '56052', 
> '85383', '85406', '85615', '105665', '1035242', '1035243']
> AND o.content =~ '.*itzndby.*' RETURN o LIMIT 20


For real queries use parameters, for project-id and permission.id ->

> MATCH (n:LABEL_TYPE_Project {id: 
> {p_id}})-[:RELATIONSHIP_scopes]->(m:LABEL_TYPE_PermissionNode)-[:RELATIONSHIP_observedBy]->(o:LABEL_TYPE_Item)
>  
> WHERE m.id in {m_ids} AND o.content =~ '.*'+{item_content}+'.*'
> RETURN o LIMIT 20


remember a realistic query performance only shows up on a warmed up system, so 
run the query at least twice

you might also want to split up your query

> MATCH (n:LABEL_TYPE_Project {id: 
> {p_id}})-[:RELATIONSHIP_scopes]->(m:LABEL_TYPE_PermissionNode)
> WHERE m.id in {m_ids} 
              WITH distinct m
              MATCH (m)-[:RELATIONSHIP_observedBy]->(o:LABEL_TYPE_Item) 
> 
> WHERE o.content =~ '.*'+{item_content}+'.*'
> RETURN o LIMIT 20


> Am 05.02.2015 um 18:07 schrieb sanderv...@gmail.com:
> 
> Hi group,
> 
> 
> I'm evaluating Neo4j for our application, and now am at a point where 
> performance is an issue. I've created a lot of nodes and edges that I'm doing 
> some queries against. The following is a detail of the nodes and edges data 
> in this database:
> 
> 
> 
> I am trying to do a search that traverses the yellow arrows of this diagram. 
> What I have so far is the following query:
> 
> MATCH (n:LABEL_TYPE_Project 
> {id:'14'})-[:RELATIONSHIP_scopes*1]->(m:LABEL_TYPE_PermissionNode)-[:RELATIONSHIP_observedBy*1]->(o:LABEL_TYPE_Item)
>  WHERE m.id in ['1', '2', '6', '12', '12064', '19614', '19742', '19863', 
> '21453', '21454', '21457', '21657', '21658', '31123', '31127', '31130', 
> '47691', '55603', '55650', '56026', '56028', '56029', '56050', '56052', 
> '85383', '85406', '85615', '105665', '1035242', '1035243'] AND o.content =~ 
> '.*itzndby.*' RETURN o LIMIT 20
> 
> The above query takes a barely-acceptable 1200ms. It only returns the 
> requested 20 items. If I want a count of the same, this takes forever:
> 
> MATCH ... the same ... RETURN count(o)
> 
> The above query takes many minutes. This is Neo4j 2.2.0-M03 Community running 
> on CentOS. There is around 385,000 nodes, 170,000 of type Item.
> 
> I have created indices on all id fields (programmatically, when inserting), 
> also on the content field.(CREATE INDEX ... statement)
> 
> Are there fundamental improvements yet to be made to my query? Things I can 
> try?
> 
> Much appreciated,
> 
> 
> Sander.
> 
> -- 
> 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 neo4j+unsubscr...@googlegroups.com 
> <mailto:neo4j+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to