Difference between ACCUM and POST_ACCUM

What is the difference between the two GSQL query below?

Start = SELECT s FROM Start:s
POST-ACCUM
do-something;

Start = SELECT s FROM Start:s
ACCUM
do-something;

ACCUM vs. POST-ACCUM

ACCUM and POST-ACCUM clauses are computed in stages, where in a SELECT-FROM-WHERE query block, ACCUM is executed first, followed by the POST-ACCUM clause.

ACCUM executes its statement(s) once for each matched edge (or path) of the FROM clause pattern. Further, ACCUM parallely executes its statements for all the matches.

POST-ACCUM executes its statement(s) once for each involved vertex. Note that each statement within the POST-ACCUM clause can refer to either source vertices or target vertices but not both.

Source: https://www.tigergraph.com/blog/accumulator-101/

1 Like

Thanks Jon!

I do understand what you said when ACCUM and POST_ACCUM are used in the same SELECT statement. What I am asking is what the difference is when the SELECT statement only has ACCUM or POST_ACCUM?

No practical difference as far as I know. In that situation it is all effectively a POST-ACCUM i.e. vertex attached computation.