I'm trying to match all nodes with specific label that has no relationship or have specific relationship. something like this two queries combined:
MATCH (f:Field)
OPTIONAL MATCH (f)--(t:Type)
WHERE id(t) = {id} RETURN f
+
MATCH (f:Field)
WHERE not (f)--(:Type)
RETURN f
Something like this:
MATCH (f:Field),(t:Type)
WHERE id(t) = {id}
AND NOT (f)--(:Type)
OR (f)--(t)
RETURN f, id(t)
ORDER BY id(t)
LIMIT 10
but this never ends to execute with 150k of :Field
s