Improve performance of in() out() and both()

82 Views Asked by At

Consider we have Vertex User, Post and Edge FriendsWith, HasPost. FriendsWith can be in both directions out and in (usually it is either out or in between 2 users). User is owner of Post.

We got 600000 users and 75 million of Posts

I use to get user friends following query:

SELECT both('FriendsWith') FROM #12:1

and to get friend posts

SELECT both('FriendsWith').out('HasPost') FROM #12:1 LIMIT 50

but if a user got many friends (~1000) the performance is not the best (~ 400 ms for getting friends and 1-5 sec on getting posts)

Is there any way to improve this queries ?

Thank you.

UPDATE

select from (select expand(both('FriendsWith').out('HasPost')) from #12:1) LIMIT 50 50 item(s) found. Query executed in 7.08 sec(s).

0

There are 0 best solutions below