ArangoDB边缘查找成本

时间:2017-09-13 09:14:20

标签: arangodb

您好我有以下收藏和关系

  • 广播(24,518 doc)
  • videoGroup(5,699 doc)
  • 剧集(124,893 doc)
  • videoClip(485,878 doc)
  • 字符(55,541 doc)

他们的藏品彼此相关,在

之下

广播有很多videoGroup(m:n),所以我创建了broadcastToVideoGroup Edge Collection 采集 videoGroup有很多剧集(1:n),所以我创建了videoGroupToEpisode EdgeCollection 剧集有很多videoClip(1:n),所以我创建episodeToVideoClip EdgeCollection

我在下面查询了所有已加入的结果

FOR b IN broadcast
    FILTER b.reg_title > NULL
    return merge(b, {series: (
        FOR s IN OUTBOUND b._id tvToSeries
            return merge(s, {episode: (
                FOR e IN OUTBOUND s._id seriesToEpisode
                    return merge(e, {clip: (
                        FOR c IN OUTBOUND e._id episodeToClip
                            return c
                    )})
            )})
    )})

解释如下

Execution plan:
 Id   NodeType                   Est.   Comment
  1   SingletonNode                 1   * ROOT
  2   EnumerateCollectionNode   24518     - FOR b IN broadcast   /* full collection scan */
  7   SubqueryNode              24518       - LET #2 = ...   /* subquery */
  3   SingletonNode                 1         * ROOT
  4   CalculationNode               1           - LET #13 = b.`_id`   /* attribute expression */   /* collections used: b : broadcast */
  5   TraversalNode                 5           - FOR c  /* vertex */ IN 1..1  /* min..maxPathDepth */ OUTBOUND #13 /* startnode */  broadcastToCharacter
  6   ReturnNode                    5           - RETURN c
 24   SubqueryNode              24518       - LET #11 = ...   /* subquery */
  8   SingletonNode                 1         * ROOT
  9   CalculationNode               1           - LET #17 = b.`_id`   /* attribute expression */   /* collections used: b : broadcast */
 10   TraversalNode                 1           - FOR s  /* vertex */ IN 1..1  /* min..maxPathDepth */ OUTBOUND #17 /* startnode */  broadcastToVideoGroup
 21   SubqueryNode                  1           - LET #9 = ...   /* subquery */
 11   SingletonNode                 1             * ROOT
 12   CalculationNode               1               - LET #21 = s.`_id`   /* attribute expression */
 13   TraversalNode                25               - FOR e  /* vertex */ IN 1..1  /* min..maxPathDepth */ OUTBOUND #21 /* startnode */  videoGroupToEpisode
 18   SubqueryNode                 25               - LET #7 = ...   /* subquery */
 14   SingletonNode                 1                 * ROOT
 15   CalculationNode               1                   - LET #25 = e.`_id`   /* attribute expression */
 16   TraversalNode                 8                   - FOR c  /* vertex */ IN 1..1  /* min..maxPathDepth */ OUTBOUND #25 /* startnode */  episodeToClip
 17   ReturnNode                    8                   - RETURN c
 19   CalculationNode              25               - LET #29 = MERGE(e, { "clips" : #7 })   /* simple expression */
 20   ReturnNode                   25               - RETURN #29
 22   CalculationNode               1           - LET #31 = MERGE(s, { "episodes" : #9 })   /* simple expression */
 23   ReturnNode                    1           - RETURN #31
 25   CalculationNode           24518       - LET #33 = MERGE(b, { "character" : #2, "videoGroup" : #11 })   /* simple expression */   /* collections used: b : broadcast */
 26   ReturnNode                24518       - RETURN #33

Indexes used:
 By   Type   Collection        Unique   Sparse   Selectivity   Fields        Ranges
  5   edge   broadcastToCharacter     false    false        19.42 %   [ `_from` ]   base OUTBOUND
 10   edge   broadcastToVideoGroup        false    false        90.89 %   [ `_from` ]   base OUTBOUND
 13   edge   videoGroupToEpisode   false    false         3.99 %   [ `_from` ]   base OUTBOUND
 16   edge   episodeToClip     false    false        11.55 %   [ `_from` ]   base OUTBOUND

在执行计划中,我想知道为什么计划不是1而是25在id 13(TravasalNode)估计。
ArangoDB边缘集合查找不是1吗?

0 个答案:

没有答案