Sunday 15 August 2010

neo4j - Cypher FOREACH MERGE not hitting the index -



neo4j - Cypher FOREACH MERGE not hitting the index -

i've got next parametrized cypher query:

merge (p:person {pid: {personid}}) on create set p.value=rand() merge (c:page {url: {pageurl}}) on create set c.value=rand() merge p-[:rel]->c foreach (tagvalue in {tags} | merge (t:tag {value:tagvalue}) merge c-[:hastag]->t)

this slow, profiling shows:

emptyresult | +updategraph(0) | +eager(0) | +updategraph(1) | +eager(1) | +updategraph(2) +----------------+------+--------+------------------------------+------------------------------------------------------------------------------+ | operator | rows | dbhits | identifiers | other | +----------------+------+--------+------------------------------+------------------------------------------------------------------------------+ | emptyresult | 0 | 0 | | | | updategraph(0) | 1 | 79222 | | foreach | | eager(0) | 1 | 0 | | | | updategraph(1) | 1 | 5 | p, c, unnamed163 | mergepattern | | eager(1) | 1 | 0 | | | | updategraph(2) | 1 | 14 | p, p, c, c | mergenode; {personid}; :person(pid); mergenode; {pageurl}; :page(url) | +----------------+------+--------+------------------------------+------------------------------------------------------------------------------+ total database accesses: 79241

as can see, it's apparently not using index i've defined on :tag(value)

any ideas how prepare this? i'm running out of ideas , i'm starting think might connected https://github.com/neo4j/neo4j/issues/861

fyi, merges convenient me , query matches (or if worked:) usage need info ingestion.

hmmm, utilize index if utilize unwind instead of foreach?

merge (p:person {pid: {personid}}) on create set p.value=rand() merge (c:page {url: {pageurl}}) on create set c.value=rand() merge p-[:rel]->c c unwind {tags} tagvalue merge (t:tag {value:tagvalue}) merge c-[:hastag]->t

neo4j cypher

No comments:

Post a Comment