Single root node

9 views
Skip to first unread message

gw

unread,
Mar 20, 2018, 8:09:31 AM3/20/18
to DataStax Java Driver for Apache Cassandra User Mailing List
Are there any query performance considerations of having a single graph root node vs. not having one?  Consider having hypothetical graph model with 4 basic node types: User, Account, Bill, and Usage.  These nodes are related to each other via 'has' relations.  However, there is no single root node for the graph.  Would creation of the 'domain_root' node be helpful?  How about adding 4 'class_root_nodes' as children of the 'domain_root' node i.e.  user_class_node (parent of all users), account_class_node (parent of all accounts), etc.   Would rooting all queries in such class root nodes speed up the queries?

Thanks in advance for any helpful points!

Cheers,
~gw

Kevin Gallardo

unread,
Mar 20, 2018, 2:19:11 PM3/20/18
to DataStax Java Driver for Apache Cassandra User Mailing List
Hi George,

It would not improve performances or help, Gremlin allows you to jump to any vertex at any time if necessary. If you wish to get all the User vertices for example, you would just filter based on the "User" label, with `g.V().hasLabel("user")....` - the underlying Graph implementation will already optimize to get to the required vertices as efficiently as possible. Using a root node would force an unnecessary extra step from the root node to the out nodes, whereas a filter on label as mentioned will be straightforward. 

Additionally using root nodes will force to create unnecessary edges, and on top of that you would potentially create unnecessary super-nodes, which will ultimately lead to many other problems.

Don't hesitate to use the DataStax Academy #dse-graph Slack channel for these kinds of questions: https://academy.datastax.com/slack.

Thanks.

gw

unread,
Mar 21, 2018, 11:51:23 AM3/21/18
to DataStax Java Driver for Apache Cassandra User Mailing List
Hi Kevin,

Thanks for your reply!
#dse-graph Slack channel seems less responsive thank this group.

Cheers,
~gw
Reply all
Reply to author
Forward
0 new messages