I asked this question a while back: Best way to timeout and return partial results?
The issue here is that certain queries may run for too long. When a query runs for a certain time, I’d like it to terminate and return partial results (i.e. whatever the accumulator state is when the time limited is reached)
But I’ve since realized that the suggested solution doesn’t really work. The issue is that you cannot timeout while a SELECT statement is being executed. This means that there is only a timeout opportunity between SELECTs, and SELECT statements can run for a very long time depending on where we are in the graph.
What I think is really needed is a way to specify a timeout for a given SELECT statement. If the timeout is reached, the SELECT should terminate immediately, and allow the query to handle the timeout. I think the existing
TRY...EXCEPTION syntax could allow for this functionality.
If you’d like some evidence that this is important functionality to provide, take a look at the TinkerPop TimeLimit step: https://tinkerpop.apache.org/docs/current/reference/#timelimit-step
Please let me know if I’m missing something, or there’s a way to do what I want. Thanks.