Hello every one
I am using neo4j 4.1.3 (Community) version
I have a graph that contains only 600 nodes and I am executing an unwind query but it is responding very slow can someone help me out
OPTIONAL MATCH(u1:User {status : '1'})-[x:POSTS]->(p:Post {status : '1'})
WHERE p.postId IS NOT NULL AND p.postType IN ['1','3'] WITH COLLECT(DISTINCT{userId : u1.userId,username : u1.username,
firstName : u1.firstName,lastName : u1.lastName,profilePic : u1.profilePic,postType : p.postType,sharedOnPersonalFeed :
p.sharedOnPersonalFeed,description : p.description,postedAt : p.postedAt, price: p.price, postData: p.postData,
viewCount: p.viewCount, commentCount: p.commentCount,totalTipReceived: p.totalTipReceived, currency: p.currency,
postId: p.postId, postedOn: p.postedOn,allowComments: p.allowComments,allowDownload: p.allowDownload, allowShare: p.allowShare })
AS rows, p
OPTIONAL MATCH(u:User {userId: '$userId', status: '1'})-[f: FOLLOW]->(u1:User {status: '1'})-[x: POSTS]->
(pp:Post {status: '1'}) WHERE p.postId <> pp.postId AND pp.postType IN ['1','3'] WITH rows,COLLECT(DISTINCT{userId : u1.userId,
username : u1.username,firstName : u1.firstName,lastName : u1.lastName,profilePic : u1.profilePic,postType : pp.postType,
sharedOnPersonalFeed : pp.sharedOnPersonalFeed,description : pp.description,postedAt : pp.postedAt,price : pp.price,
postData : pp.postData,viewCount : pp.viewCount,commentCount : pp.commentCount,totalTipReceived : pp.totalTipReceived,
currency: pp.currency, postId: pp.postId, postedOn: pp.postedOn, allowComments: pp.allowComments,allowDownload: pp.allowDownload,
allowShare: pp.allowShare }) AS allrows UNWIND (allrows + rows) AS x WITH x
WHERE x.postId IS NOT NULL MATCH(p:Post {status : '1'})
WHERE p.postId = x.postId OPTIONAL MATCH (p)<-[l:LIKES]-(uLike:User {userId: '$userId',status : '1'})
WITH x,p,COUNT(l) AS isLike OPTIONAL MATCH (p)<-[ll:LIKES]-(tLike:User {status : '1'}) WITH p, x,isLike,COUNT(ll) AS totalLike
OPTIONAL MATCH (p)<-[pp2:POSTPURCHASE]-(up:User {userId: '$userId',status : '1'}) WITH p, x,isLike,totalLike,
COUNT(pp2) AS isVisible OPTIONAL MATCH (p)<-[b:BOOKMARK]-(uBook:User {userId: '$userId',status : '1'}) WITH p, x,
isLike,totalLike,isVisible,COUNT(b) AS isBookmarked OPTIONAL MATCH(p)-[tt: TAGGEDUSER]->(u2: User {status : '1'}) WITH p, x,isLike,
totalLike,isVisible,isBookmarked,COLLECT(DISTINCT{userId: u2.userId, username: u2.username, firstName: u2.firstName,
lastName: u2.lastName,profilePic: u2.profilePic }) [0..5] AS taggedUsers
RETURN DISTINCT x.userId AS userId,x.username AS username,
x.firstName AS firstName, x.lastName AS lastName, x.profilePic AS profilePic,x.postType AS postType,
x.sharedOnPersonalFeed AS sharedOnPersonalFeed, x.description AS description, x.postedAt AS postedAt,x.price AS price,
x.postData AS postData, x.viewCount AS viewCount, x.commentCount AS commentCount,x.totalTipReceived AS totalTipReceived,
x.currency AS currency,x.postId AS postId, x.postedOn AS postedOn, x.allowComments AS allowComments, x.allowDownload AS allowDownload,
x.allowShare AS allowShare,taggedUsers,isLike,totalLike,isVisible,isBookmarked ORDER BY x.postedAt DESC SKIP 0 LIMIT 10