Reputation: 1034
which of these queries is cost effective when considering network calls and query process time
1)
g.V().has('personId','1234')
=> V[4232]
2)
g.V().has('personId','1234').values('name','age')
=> chris
=> 24
3)
g.V().has('personId','1234').valueMap('name','age')
=> [name:[chris],age:[24]]
4)
g.V().has('personId','1234').properties('name','age')
=> vp[name->chris
=>vp[age->24]
does getting the whole vertex cost us more of network bandwidth . i usually get vertices as the query processing is done quickly
Upvotes: 0
Views: 82
Reputation: 46226
The cheapest will be options two and three. Returning an Element
, which would be a Vertex
, Edge
, VertexProperty
will be more costly than returning an individual result or a Map
or results. Even the following is less expensive than returning an entire Element
:
g.V(1).valueMap(true)
which from a data perspective is basically the same as g.V(1)
.
The basic rule ends up being not so different than SQL. You likely wouldn't do a SELECT * FROM table
, nor should you return all the data from an element - only retrieve the data you need.
Upvotes: 2