mquery

The mquery operator is deprecated in release 22.5, and will be removed in a later version.
Instead of mquery, you should now use the begin(), commit(), and rollback() operators, as described in Transactions and Transaction Operators.

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.

Supported Operators

Operator mquery() supports add_attributes(), create_array(), delete(), insert(), remove(), and remove_versions() with exceptions noted by operator below.

create_array()

Arrays may be created within mquery() with the AFL create_array() operator. The AQL equivalent, create array, is not supported.

insert(), delete()

The _fetch keyword is not supported in insert() and delete() when invoked from mquery().

remove(), remove_versions()

These operators may only affect arrays created within the same mquery() statement that they themselves appear.

Limitations

  1. No DDL permitted in mquery() except for create_array() and remove()/remove_versions() as explained above.

  2. There is no AQL-equivalent mquery() counterpart.

  3. Arrays updated by mquery() have READ UNCOMMITTED isolation with respect to other mquery()s and transactions. For better isolation, see Transactions.

  4. Arrays renamed during mquery() are globally visible at the moment rename() executes successfully because array names are not versioned.

Examples

Inserting into an array that already exists:

Creating a new array, inserting into it, adding attributes, populating new attributes, and removing prior versions:

Â