Collect and filter data

I have a complicated query that yields certain vertices, on which I later call .project. It looks somehow like this: complexQuery.project("a", "b", "c", ...).by(queryA).by(queryB).by(queryC).by(...) What I want to do is to later filter the results by some predicates over a, b, c, .... For example, maybe I want to select on those results, where b > 10. And that's when the question arrive: I could add filtering steps after the project, but is this any efficient? I'm just unsure about how gremlin evaluates it: does gremlin at first fully evaluates project and then goes to the following steps, or is the computation of fields a, b, c, ... delayed until they are being filtered on?
Solution:
I'd say that the best general advice is for you to write your filters as early as possible to rid Gremlin of as many paths as possible. The only real way to tell what sort of optimizations you are getting though is to test/profile your queries on the graph you are using. TinkerPop doesn't dictate how graphs optimize Gremlin queries so what might work really fast on one may not be best on another.
Jump to solution
1 Reply
Solution
spmallette
spmallette2y ago
I'd say that the best general advice is for you to write your filters as early as possible to rid Gremlin of as many paths as possible. The only real way to tell what sort of optimizations you are getting though is to test/profile your queries on the graph you are using. TinkerPop doesn't dictate how graphs optimize Gremlin queries so what might work really fast on one may not be best on another.
Want results from more Discord servers?
Add your server