Thirumal
Thirumal

Reputation: 9686

Which is faster g.V(T.id) or g.V().hasLabel('emaployee').has(T.id, 1) in gremlin

Which is faster g.V(T.id) or g.V().hasLabel('emaployee').has(T.id, 1) in apache tinkerpop gremlin.

I have both id as well label which one is better, from a programming perspective g.V(T.id) is simpler but what about the DB performance? is it the same for both?

Upvotes: 2

Views: 115

Answers (1)

Kelvin Lawrence
Kelvin Lawrence

Reputation: 14391

You have listed several databases in the tags, so I'm not sure which one you are mostly asking about. In general, if you know the ID, you never need to check the label as IDs are required to be unique. The only case you might check is if you are unsure if a given ID is of the required label type.

In general I always use g.V(some-id) if I know the ID

Upvotes: 4

Related Questions