3

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).

Fedir Petryk
  • 497
  • 3
  • 16
  • About the posts, in the case of 5 seconds, how many records are fetched? Are you interested only on the first 50? Try: `SELECT FROM ( SELECT expand( both('FriendsWith').out('HasPost') ) FROM #12:1 ) LIMIT 50` – Lvca Jan 23 '16 at 23:29
  • Yes in the first 50. I will add performance results later. Your proposal didn't really change results. – Fedir Petryk Jan 24 '16 at 16:03
  • @Lvca can I use fetchingPlan to speed up getting friend posts? – Fedir Petryk Jan 25 '16 at 16:01

0 Answers0