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

Commit 6cbf3df

Browse files
Simran-Bnerpaula
andauthored
Add details about the remove-sort-rand-limit-1 optimizer rule (#1285)
Co-authored-by: Paula Mihu <[email protected]>
1 parent 35de1a5 commit 6cbf3df

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

3.10/aql/execution-and-performance-optimizer.md

+5
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,11 @@ The following optimizer rules may appear in the `rules` attribute of a plan:
612612
Appears when a `SORT RAND() LIMIT 1` construct is removed by moving the
613613
random iteration into an `EnumerateCollectionNode`.
614614

615+
The RocksDB storage engine doesn't allow to seek random documents efficiently.
616+
This optimization picks a pseudo-random document based on a limited number of
617+
seeks within the collection's key range, selecting a random start key in the
618+
key range, and then going a few steps before or after that.
619+
615620
- `remove-unnecessary-calculations`:
616621
Appears if `CalculationNode`s are removed from the query. The rule
617622
removes all calculations whose result is not referenced in the query (note

3.11/aql/execution-and-performance-optimizer.md

+5
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,11 @@ The following optimizer rules may appear in the `rules` attribute of a plan:
611611
- `remove-sort-rand-limit-1`:
612612
Appears when a `SORT RAND() LIMIT 1` construct is removed by moving the
613613
random iteration into an `EnumerateCollectionNode`.
614+
615+
The RocksDB storage engine doesn't allow to seek random documents efficiently.
616+
This optimization picks a pseudo-random document based on a limited number of
617+
seeks within the collection's key range, selecting a random start key in the
618+
key range, and then going a few steps before or after that.
614619

615620
- `remove-unnecessary-calculations`:
616621
Appears if `CalculationNode`s are removed from the query. The rule

0 commit comments

Comments
 (0)