Hi,

as of ArangoDB 3.4, `RETURN DISTINCT` (which is turned into a `COLLECT` 
statement by the optimizer) is not able to make use of indexes.
The same is true for any other form of `COLLECT`. Indexes will be used for 
filtering and sorting, but right now they are not used for any sort of 
aggregation.

Best regards
Jan

Am Sonntag, 19. Mai 2019 15:29:45 UTC+2 schrieb Andreas Jung:
>
> Running ArangoDB 3.4.5 on a collection with 100.000 items.
> Each item has singe-valued field _type and there are about 20 different 
> values for this field.
> The field is indexed by a hash index: https://nimb.ws/yh4rRb
>
> This query performs a full table scan instead of using the index.
> Am I missing something here?
>
> For doc in import
>     return distinct doc._type
>
> Query String:
>  For doc in import
>      return distinct doc._type
>
> Execution plan:
>  Id   NodeType                   Est.   Comment
>   1   SingletonNode                 1   * ROOT
>   2   EnumerateCollectionNode   95238     - FOR doc IN import   /* full 
> collection scan, projections: `_type` */
>   3   CalculationNode           95238       - LET #1 = doc.`_type`   /* 
> attribute expression */   /* collections used: doc : import */
>   4   CollectNode               76190       - COLLECT #3 = #1   /* 
> distinct */
>   5   ReturnNode                76190       - RETURN #3
>
> Indexes used:
>  none
>
> Optimization rules applied:
>  Id   RuleName
>   1   reduce-extraction-to-projection
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/arangodb/2c5efa6f-f1e6-4db9-8f18-07e19997e92e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to