Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-30-2022 09:14 AM
Welcome back to our Weekly challenge series!
In keeping with the theme so far, this week's challenge is to tune the provided query.
Here's what you need to do!
"PROFILE
MATCH (m:Movie)<-[:ACTED_IN]-(a:Person)
WITH m, collect(a.name) as actorNames
WHERE size(actorNames) <= $maxActors
RETURN m.title, m.year, actorNames"
Solutions submitted between 8/30 and 9/9 will be eligible for a Neo4j T-Shirt drawing!
Show us your ways to improve the query!
08-30-2022 09:25 AM
Hello @TrevorS 😊
:param maxActors => 2;
MATCH (m:Movie)
WHERE 0 < size((m)<-[:ACTED_IN]-()) <= $maxActors
RETURN m.title, m.year, [(m)<-[:ACTED_IN]-(a) | a.name] AS actorNames;
Regards,
Cobra
08-31-2022 12:23 AM - edited 08-31-2022 12:25 AM
size((m)<-[:ACTED_IN]-())
I don't think it's possible to beat that as suggested by @Cobra
11-29-2022 09:25 PM
Best I could do was 20,050 db hits haha, I believe adding the "0 < " is unnecessary right? For size to return < 0 wouldn't be possible? And it adds processing time (and somehow db hits?) so below is very very very barely faster 😉 hahah
All the sessions of the conference are now available online