Hi guys, The below query matches a whole lot of nodes but only returns a few.
I would like to know how neo4j processes the query internally. Mainly, will neo4j first fetch all the nodes from the MATCH statement and then return the ones we need or does it optimise the query first by looking at the RETURN statement and matching only the ones that makes sense. I'm concerned about performance. I appreciate that a query like the below with redundant matches doesn't make much sense. The reason we have such queries is that we construct queries for complex models in our code, rather than hand crafting each individual query. Example of a query I'm concerned about: START root=node(0) MATCH root-[:HAS_PERSON]-person, person-[?:HAS_LANGUAGE]-lang, person-[?:HAS_ETHNICITY]-ethnicity, person-[?:HAS_OFFENCE]-offence, person-[?:HAS_AKA]-aka, person-[?:HAS_EMAIL]-email, person-[?:HAS_PHONE]-phone, person-[?:HAS_ADDRESS]-address WHERE person.Id = 123 RETURN person, collect(distinct aka) -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
