Having had the good fortune of meeting Michael Hunger at OOP Munich, I now explore his first suggested optimizations. See Neo4J
Add an index to avoid full database scan.
CREATE CONSTRAINT ON (s:Site) ASSERT s.title IS UNIQUE; CREATE INDEX ON :Page(title);
Improve query.
MATCH (site:Site)-[:HAS]-> (page:Page)-[:LINK]-> (link:Title)<-[:IS]-(p:Page), (page)-[:KNOWS]->(here:Site) WHERE here.title in {sites} AND p.title IN {slugs} WITH page, site, link, count(*) as freq ORDER BY freq desc RETURN page.title,site.title,link.title;
I have applied these ad-hoc and seen query performance as fast as 300 msec but sometimes much slower. Michael reports 9 msec but not on my Digital Ocean server.