Maybe an equivalent to SELECT ... UNION SELECT ... would help in your case?
You could try to use multiple subqueries to prepare the data and merge the
data together at the end.
Another way would be to move the projection code to Foxx and run multiple
queries transactionally, then combine the result with JavaScript. Or write
a custom AQL function for the projection?
(Technical explanation by Jan, translated to English:)
The expression cond ? a : b is evaluated like this:
```
r1 = a;
r2 = b;
if (cond) { a; } else { b; }
There are optimizations for the case, that cond is a constant and the value
is known from the beginning. In that case, there is a jump directly to a.
But it is possible that subqueries are not optimized away and the following
happens:
```r1 = a;
r2 = b;
a;
```
If b is a subquery, then it it evaluated anyway. And if the the condition
cond is not known from the beginning (i.e. it is dynamic), then the
subquery is always executed.
The only way around this would be to evaluate everything lazily, but it
would be very tricky to implement. At the moment, subqueries in expressions
are taken out and run before the expression is evaluated:
```tmp = (subquery);
r1 = "ok";
r2 = tmp;
cond = true;
if (cond) { r1; } else { r2; }
```
Or:
```tmp = (subquery);
r1 = "ok";
r1;
```
In case of
`RETURN true ? "ok" : (RETURN FAIL())`
the subquery is not optimized away because FAIL()` is a special
function. Expressions, which can throw errors are generally not optimized
away.
--
You received this message because you are subscribed to the Google Groups
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.