|-
| '''Summary'''
|Prepares the supplied {{Code|$query}} string for asynchronous execution and returns a query id. The query will be queued as described in the article on [[Transaction Management]], and the result will be cached in main-memory until it is fetched via [[#async:result|async:result]], or until {{Option|ASYNCTIMEOUT}} is exceeded. Queries may be updating.<br/>Variables and context items can be declared via {{Code|$bindings}} (see [[XQuery Module#xquery:eval|xquery:eval]] for more details). The {{Code|$options}} parameter contains evaluation options:
* {{Code|cache}}: indicates if the query result will be cached or ignored (default: <code>true</code>). If the query result will not be cached, the query id will immediately be discarded after query execution, too.
* {{Code|base-uri}}: set [https://www.w3.org/TR/xquery-31/#dt-static-base-uri base-uri property] for the query. This URI will be used when resolving relative URIs by functions such as {{Code|fn:doc}} (default: ''empty string'').
|-
| '''Errors'''
|{{Error|updating|#Errors}} the query contains update operations.
|-
| '''Examples'''
};
</pre>
|}
==async:update==
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|async:update|$query as xs:string|xs:string}}<br />{{Func|async:update|$query as xs:string, $bindings as map(*)|xs:string}}<br />{{Func|async:update|$query as xs:string, $bindings as map(*), $options as map(xs:string, xs:string)|xs:string}}<br />
|-
| '''Summary'''
|Prepares the supplied {{Code|$query}} string for asynchronous execution and returns a query id. The query will be queued as described in the article on [[Transaction Management]].<br/>See [[#async:eval|async:eval]] for information on the <code>$bindings</code> and <code>$options</code> arguments.
|-
| '''Errors'''
|{{Error|non-updating|#Errors}} the query does not contain any update operations.<br/>
|-
| '''Examples'''
|
* <code>async:update("delete node db:open('db')//text()", map {}, map { 'cache': false() })</code> returns a query id. The text nodes of the database <code>db</code> will be deleted once the database is available for write access.
|}
|{{Code|out-of-range}}
| The supplied option is out of range.
|-
|{{Code|updating}}
| A query is expected to be non-updating, but it performs updates.
|-
|{{Code|non-updating}}
| A query is expected to be updating, but it does not perform updates.
|-
|{{Code|unknown}}