8000 Add limits for AQL query complexity by jsteemann · Pull Request #726 · arangodb/docs · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

Add limits for AQL query complexity #726

Merged
merged 5 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3.9/aql/extending-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ purely functional and thus free of side effects and state, and state modificatio

{% hint 'warning' %}
Modification of global variables is unsupported, as is reading or changing
the data of any collection from inside an AQL user function.
the data of any collection or running queries from inside an AQL user function.
{% endhint %}

User function code is late-bound, and may thus not rely on any variables
Expand Down
4 changes: 4 additions & 0 deletions 3.9/aql/extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ To overcome these mentioned limitations, you may want to increase the
(at the expense of increased memory usage), and the
[number of available server threads](../programs-arangod-server.html#server-threads).

In addition, modification of global JavaScript variables from inside UDFs is
unsupported, as is reading or changing the data of any collection or running
queries from inside an AQL user function.

### Deployment Details

Internally, UDFs are stored in a system collection named `_aqlfunctions`
Expand Down
16 changes: 15 additions & 1 deletion 3.9/aql/fundamentals-limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ description: Known limitations that apply in AQL queries
Known limitations for AQL queries
=================================

The following limitations are known for AQL queries:
The following hard-coded limitations exist for AQL queries:

- An AQL query cannot use more than _1000_ result registers.
One result register is needed for every named query variable and for
internal/anonymous query variables.
- An AQL query cannot have more than _4000_ execution nodes in its initial
query execution plan.
- An AQL query cannot use more than _2048_ collections/shards.
- It is not possible to use a collection in a read operation after
it was used for a write operation in the same AQL query.
Expand All @@ -18,6 +20,18 @@ The following limitations are known for AQL queries:
[`DOCUMENT()` function](functions-miscellaneous.html#document) or
[traversals working with collection sets](graphs-traversals.html#working-with-collection-sets)
(instead of named graphs).
- Expressions in AQL queries cannot have a nesting of more than _500_ levels.
As an example, the expression `1 + 2 + 3 + 4` is 3 levels deep
(because it is interpreted and executed as `1 + (2 + (3 + 4))`).

Please note that even queries that are still below these limits may not
yield good performance, especially when they have to put together data from lots
of different collections. Please also consider that large queries (in terms of
intermediate result size or final result size) can use considerable amounts of
memory and may hit the configurable memory limits for AQL queries.

The following other limitations are known for AQL queries:

- Subqueries that are used inside expressions are pulled out of these
expressions and executed beforehand. That means that subqueries do not
participate in lazy evaluation of operands, for example in the
Expand Down
20 changes: 20 additions & 0 deletions 3.9/release-notes-upgrading-changes39.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ now expected to be present on all targets that run ArangoDB 3.9 executables.
If a target does not support AVX instructions, it may fail with SIGILL at
runtime.

AQL
---

The following complexity limits have been added in 3.9 for AQL queries,
Additional complexity limits have been added for AQL queries, in order to
prevent programmatically generated large queries from causing trouble
(too deep recursion, enormous memory usage, long query optimization
and distribution passes etc.).

The following limits have been added:

- a recursion limit for AQL query expressions. An expression can now be
up to 500 levels deep. An example expression is `1 + 2 + 3 + 4`, which
is 3 levels deep `1 + (2 + (3 + 4))`.
The recursion of expressions is limited to 500 levels.
- a limit for the number of execution nodes in the initial query
execution plan. The number of execution nodes is limited to 4,000.

Also see [Known limitations for AQL queries](aql/fundamentals-limitations.html).

Startup options
---------------

Expand Down
4 changes: 2 additions & 2 deletions 3.9/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ For a detailed list of changes to the ArangoDB core programs and tools,
please refer to the version specific changelogs:

- Changelogs 3.x:
[3.8](https://raw.githubusercontent.com/arangodb/arangodb/3.9/CHANGELOG){:target="_blank"},
[3.9](https://raw.githubusercontent.com/arangodb/arangodb/3.9/CHANGELOG){:target="_blank"},
[3.8](https://raw.githubusercontent.com/arangodb/arangodb/3.8/CHANGELOG){:target="_blank"},
[3.7](https://raw.githubusercontent.com/arangodb/arangodb/3.7/CHANGELOG){:target="_blank"},
[3.6](https://raw.githubusercontent.com/arangodb/arangodb/3.6/CHANGELOG){:target="_blank"},
Expand Down Expand Up @@ -72,7 +72,7 @@ Also see [Version Specific Upgrade Information](upgrading-version-specific.html)
in the _Upgrading_ chapter.

- Incompatible changes in 3.x:
[3.8](release-notes-upgrading-changes39.html),
[3.9](release-notes-upgrading-changes39.html),
[3.8](release-notes-upgrading-changes38.html),
[3.7](release-notes-upgrading-changes37.html),
[3.6](release-notes-upgrading-changes36.html),
Expand Down
0