简体   繁体   中英

ArangoDB: How to run 2 queries in parallel in community edition

Hi I have written the below 2 queries and would like to run in these queries in parallel and not execute them sequentially. Is it possible to execute them parallelly in the community edition of the ArangoDB?

FOR d IN Transaction
        FILTER d._to == "Account/123" 
        COLLECT AGGREGATE length = COUNT_UNIQUE(d._id), 
                          totamnt = SUM(d.Amount),
                          daysactive = COUNT_UNIQUE(DATE_TRUNC(d.Time, "day"))
        RETURN { 
            "Incoming Accounts": length , 
            "Days Active": LENGTH(daysactive), 
            "Total Amount": totamnt 
        }
        
FOR d IN Transaction
        FILTER d._from == "Account/123" 
        COLLECT AGGREGATE length = COUNT_UNIQUE(d._id), 
                          totamnt = SUM(d.Amount),
                          daysactive = COUNT_UNIQUE(DATE_TRUNC(d.Time, "day"))
        RETURN { 
            "Outgoing Accounts": length , 
            "Days Active": LENGTH(daysactive), 
            "Total Amount": totamnt 
        }

of course it is possible to run multiple requests in parallel. Just fire 2 curl calls to _api/cursor or use 2 different arangosh shells.

Or run 2 curl calls in the same shell and use the x-arango-async header for each request to retrieve the result asynchronously as documented here: https://www.arangodb.com/docs/stable/http/async-results-management.html#async-execution-and-later-result-retrieval

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM