Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-05-2020 10:53 AM
I need help in understanding the IN
operator
In my following example:
MATCH (a1:Author)-[co:COAUTHOR]-(a2:Author) WHERE co.year IN [2017,2018,2019,2020] RETURN a1,co,a2
The operator tests every year every time in array to compute a MATCH
OR tests each year in array by index (starting from 2017 THEN going to 2018 ... 2020)
Im in doubt if need to use some logic to iterate the array of years, in this example, to compute the required MATCH
.
Solved! Go to Solution.
08-05-2020 01:54 PM
For relationship there is no index, so it gets all relationships first and then checks if the year is in the list provided.
If you try profiling you will see a DB scan.
Say if the year is an attribute on Author node and you have index on year then it would use index based look up similar to
year=2017 or year=2018 or year=2019 or year=2020.
Hope that makes it clear.
08-05-2020 01:54 PM
For relationship there is no index, so it gets all relationships first and then checks if the year is in the list provided.
If you try profiling you will see a DB scan.
Say if the year is an attribute on Author node and you have index on year then it would use index based look up similar to
year=2017 or year=2018 or year=2019 or year=2020.
Hope that makes it clear.
08-06-2020 10:08 AM
Thanks for explanation, now i understand better.
All the sessions of the conference are now available online