Limit on MapAccum Nesting?

I have a query that nests MapAccums 4 deep, but the query never returns, even though the activity monitor on the admin page suggests all processing has concluded. Is there a limit to how deep MapAccums can be nested?

Hi Parker.

My gut feeling is that this is due to some other reason.

Could you please make sure all services is up? And if you don’t mind could you please post your query here since we can get more info from the query logic.

Sometimes large result being printed can make the system behave that way.


Thanks - All of the services are up. It very well could be the large result being printed - would writing the result to a file resolve this? I am not sure if I can post the query here unfortunately.

Yes, printing to file will surely help. Please let me know how it goes.


1 Like

So it does appear to be an issue with how big of a result my ACCUM becomes - when I add a LIMIT 2 clause to the SELECT, the query works as expected. However, when the LIMIT is removed (or even increased to 3), the query fails to return as initially described, even when there is no file println or PRINT statement returning the accumulator. It just never returns the json of the PRINT statement that is only supposed to return the time elapsed.

1 Like

Limit only impact the starting set of following select statement. So I assume the accum you are referring to is after the limit clause. In that case. we need to evaluate the outdegree number of hubnode vertexes. Since now adding one extra node to the traversal can largely impact your query performance.

You can consider to use this query to find your top k hubnodes.

CREATE QUERY outdegreeDist(int bucketSize=100, int topk=10) FOR GRAPH GRAPH_NAME {
MapAccum<int, int> @@dist;
SumAccum @od;
start = {ANY};
start = select s from start:s
post-accum @@dist += (s.outdegree()/bucketSize->1),
s.@od = s.outdegree()
order by s.outdegree() desc
limit topk;
print start;
print @@dist;

Correct, I am using the LIMIT clause to not run the ACCUM on the entire resulting vertex set from a SELECT statement. However, the vertex outdegree is small (like 5 or 6), however, the accumulator operation is quite intensive (and collect a lot of data).

It is hard to tell without looking at the query and logs.

Could you email your query to I believe we have NDA signed.


Sent the email, let me know if you want additional information or to setup a call. Thanks!