mquery
The mquery operator ties the fate of several queries together into one larger query, called a multiquery.
Synopsis
Operator mquery() will take one or more AFL statements and execute them sequentially,
starting with the first, as one query.
mquery(afl_statement_1,
afl_statement_2,
...,
afl_statement_n);The latest version of an array produced by some afl_statement_j (where j is one of n total
AFL statements in a given mquery()) is visible for each successive afl_statement_(j+1)
(put another way, later AFL statements in a mquery() see the latest versions of arrays
updated by earlier AFL statements of the same mquery() query).
Once the first AFL statement has executed successfully, the second will then execute.
mquery(afl_statement_1, -- Executes successfully (first).
afl_statement_2) -- Following afl_statement_1, executes successfully (second).Should any one AFL statement fail, then any changes to SciDB array state will be
rolled back for executed statements and subsequent statements will not be executed.
mquery(afl_statement_1, -- Executes successfully.
afl_statement_2) -- Failure here, rollback array state changes from afl_statement_1.Limitations
No DDL permitted in
mquery().Top-level AFL statements in
mquery()may only beinsert()ordelete()._fetchkeyword not supported ininsert()anddelete()when invoked frommquery().No AQL-equivalent for
mquery()counterpart will be implemented.Arrays updated by
mquery()haveREAD COMMITTEDisolation with respect to other queries.
Example
AFL% create array target <v:int64> [i=1:10];
AFL% mquery(insert(build(target, 2*i+1), target),
insert(project(apply(target, vnew, 3*v), vnew), target));
AFL% scan(target@1);
{i} v
{1} 3
{2} 5
{3} 7
{4} 9
{5} 11
{6} 13
{7} 15
{8} 17
{9} 19
{10} 21
AFL% scan(target@2);
{i} v
{1} 9
{2} 15
{3} 21
{4} 27
{5} 33
{6} 39
{7} 45
{8} 51
{9} 57
{10} 63