Neo4j cypher Recommendations Query Performance Issues -
i'm working on product recommendation query should return products recommend current customer based on finding similar customers based on viewing similar products , suggesting other products similar customers have viewed. our business in consignment have 1 of every product i'm working larger dataset in similar views vs purchases. expectation query should able run in under second given being run against little on 10k products , 10k users in our development environment. i'm unsure if query needs tuning, linux/java/neo4j config or both. have experience in this?
match (currentuser:websiteuser{uuid: 'ea1d35e7-73e6-4990-b7b5- 2db24121da9b'})-[:viewed]->(i:websiteitem)<-[:viewed]- (similaruser:websiteuser)-[r:viewed]->(similaritem:websiteitem {active: true}) return similaritem.designer, similaritem.title, similaritem.brandsize, similaritem.sku, similaritem.shopifyproductid, similaritem.url, similaritem.price, count(distinct r) score order score desc limit 15
profile output:
after doing further research, , trying many different suggestions other posts across internet related both performance tuning of machine , query i've found following query rewrite provide best speed based on rewriting query in steps , using distinct limit expansion ballooning of results 1 segment of query next.
match (u:websiteuser{uuid: 'ea1d35e7-73e6-4990-b7b5-2db24121da9b'}) match (u)-[:viewed]->(i:websiteitem) distinct match (i)<-[:viewed]-(su:websiteuser) distinct su match (su)-[r:viewed]->(si:websiteitem {active: true}) return si.designer, si.title, si.brandsize, si.sku, si.shopifyproductid, si.url, si.price, count(distinct r) score order score desc limit 15
Comments
Post a Comment