-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature 3.3/aql optimizations #5140
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…e documents are not needed
…re-3.3/aql-optimizations
…re-3.3/aql-optimizations
…es (OR on conditions that use the same index)
This was referenced Apr 19, 2018
graetzer
approved these changes
May 1, 2018
…re-3.3/aql-optimizations
…re-3.3/aql-optimizations
mchacki
approved these changes
May 4, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…re-3.3/aql-optimizations
28 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds the following optimizations:
remove post-sort from GatherNode in cluster AQL queries that do use indexes
for filtering but that do not require a sorted result
This optimization can speed up gathering data from multiple shards, because
it allows to remove a merge sort of the individual shards' results.
extend the already existing "reduce-extraction-to-projection" AQL optimizer
rule for RocksDB to provide projections of up to 5 document attributes. The
previous implementation only supported a projection for a single document
attribute. The new implementation will extract up to 5 document attributes from
a document while scanning a collection via an EnumerateCollectionNode.
Additionally the new version of the optimizer rule can also produce projections
when scanning an index via an IndexNode.
The optimization is benefial especially for huge documents because it will copy
out only the projected attributes from the document instead of copying the entire
document data from the storage engine.
When applied, the explainer will show the projected attributes in a
projections
remark for an EnumerateCollectionNode or IndexNode. The optimization is limited
to the RocksDB storage engine.
added index-only optimization for AQL queries that can satisfy the retrieval of
all required document attributes directly from an index.
This optimization will be triggered for the RocksDB engine if an index is used
that covers all required attributes of the document used later on in the query.
If applied, it will save retrieving the actual document data (which would require
an extra lookup in RocksDB), but will instead build the document data solely
from the index values found. It will only be applied when using up to 5 attributes
from the document, and only if the rest of the document data is not used later
on in the query.
The optimization is currently available for the RocksDB engine for the index types
primary, edge, hash, skiplist and persistent.
If the optimization is applied, it will show up as "index only" in an AQL
query's execution plan for an IndexNode.
added scan-only optimization for AQL queries that iterate over collections or
indexes and that do not need to return the actual document values.
Not fetching the document values from the storage engine will provide a
considerable speedup when using the RocksDB engine, but may also help a bit
in case of the MMFiles engine. The optimization will only be applied when
full-scanning or index-scanning a collection without refering to any of its
documents later on, and, for an IndexNode, if all filter conditions for the
documents of the collection are covered by the index.
If the optimization is applied, it will show up as "scan only" in an AQL
query's execution plan for an EnumerateCollectionNode or an IndexNode.
extend existing "collect-in-cluster" optimizer rule to run grouping, counting
and deduplication on the DB servers in several cases, so that the coordinator
will only need to sum up the potentially smaller results from the individual shards.
The following types of COLLECT queries are covered now:
aggregate functions COUNT/LENGTH, SUM, MIN and MAX.
honor specified COLLECT method in AQL COLLECT options
for example, when the user explicitly asks for the COLLECT method
to be
sorted
, the optimizer will now not produce an alternativeversion of the plan using the hash method.
additionally, if the user explcitly asks for the COLLECT method to
be
hash
, the optimizer will now change the existing plan to usethe hash method if possible instead of just creating an alternative
plan.
COLLECT ... OPTIONS { method: 'sorted' }
=> always use sorted methodCOLLECT ... OPTIONS { method: 'hash' }
=> use hash if this is technically possibleCOLLECT ...
(no options) => create a plan using sorted, and another plan using hash methodNote that there is also a corresponding enterprise branch.