8000 Feature/explain spliced subqueries by mchacki · Pull Request #10298 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/explain spliced subqueries #10298

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

Merged
merged 3 commits into from
Oct 22, 2019
Merged

Conversation

mchacki
Copy link
Member
@mchacki mchacki commented Oct 22, 2019

Modified Explain to be able to print spliced (optimized) subqueries within the Explain out.
Unfortunately I had to add an additional variable to the Subquery Start Node, this has potential to be dumped again later. The variable has no "Production" semantics.

Jenkins:
http://jenkins01.arangodb.biz:8080/view/PR/job/arangodb-matrix-pr/6816/

Non-spliced subquery:

Query String (94 chars, cacheable: true):
 FOR x IN 1..2 LET y = (FOR z IN 1..2 LET a = (FOR b IN 1..2 RETURN b) RETURN [x,z,a]) RETURN y

Execution plan:
 Id   NodeType            Est.   Comment
  1   SingletonNode          1   * ROOT
  2   CalculationNode        1     - LET #9 = 1 .. 2   /* range */   /* simple expression */
  3   EnumerateListNode      2     - FOR x IN #9   /* list iteration */
 14   SubqueryNode           2       - LET y = ...   /* subquery */
  4   SingletonNode          1         * ROOT
  5   CalculationNode        1           - LET #11 = 1 .. 2   /* range */   /* simple expression */
  6   EnumerateListNode      2           - FOR z IN #11   /* list iteration */
 11   SubqueryNode           2             - LET a = ...   /* const subquery */
  7   SingletonNode          1               * ROOT
  8   CalculationNode        1                 - LET #13 = 1 .. 2   /* range */   /* simple expression */
  9   EnumerateListNode      2                 - FOR b IN #13   /* list iteration */
 10   ReturnNode             2                   - RETURN b
 12   CalculationNode        2             - LET #15 = [ x, z, a ]   /* simple expression */
 13   ReturnNode             2             - RETURN #15
 15   ReturnNode             2       - RETURN y

Indexes used:
 none

Optimization rules applied:
 none

Spliced subquery:

Query String (94 chars, cacheable: true):
 FOR x IN 1..2 LET y = (FOR z IN 1..2 LET a = (FOR b IN 1..2 RETURN b) RETURN [x,z,a]) RETURN y

Execution plan:
 Id   NodeType            Est.   Comment
  1   SingletonNode          1   * ROOT
  2   CalculationNode        1     - LET #9 = 1 .. 2   /* range */   /* simple expression */
  3   EnumerateListNode      2     - FOR x IN #9   /* list iteration */
 16   SubqueryStartNode      2       - LET y = ( /* subquery begin */
  5   CalculationNode        2         - LET #11 = 1 .. 2   /* range */   /* simple expression */
  6   EnumerateListNode      4         - FOR z IN #11   /* list iteration */
 18   SubqueryStartNode      4           - LET a = ( /* subquery begin */
  8   CalculationNode        4             - LET #13 = 1 .. 2   /* range */   /* simple expression */
  9   EnumerateListNode      8             - FOR b IN #13   /* list iteration */
 10   ReturnNode             8               - RETURN b
 19   SubqueryEndNode        8           - ) /* subquery end */
 12   CalculationNode        8           - LET #15 = [ x, z, a ]   /* simple expression */
 13   ReturnNode             8           - RETURN #15
 17   SubqueryEndNode        8       - ) /* subquery end */
 15   ReturnNode             8       - RETURN y

Indexes used:
 none

Optimization rules applied:
 Id   RuleName
  1   splice-subqueries

NOTE:
The estimated cost is different.
The non-optimized code prints cost within subqueries only for one round trip, and exposes only the total mount of executed subqueries to the following nodes
The optimized code prints cost assumptions accumulated for all subquery executions.

Need discussion if we want to adapt this or not.

@mchacki mchacki added this to the devel milestone Oct 22, 2019
@mchacki mchacki requested review from markuspf and goedderz October 22, 2019 11:31
@mchacki mchacki self-assigned this Oct 22, 2019
@mchacki mchacki requested a review from hkernbach October 22, 2019 11:33
@mchacki
Copy link
Member Author
mchacki commented Oct 22, 2019

Jenkins error is 100% unrelated to this pr.
Everything else is blue according to Jenkins run

@mchacki mchacki merged commit bf2423d into devel Oct 22, 2019
@mchacki mchacki deleted the feature/explain-spliced-subqueries branch October 22, 2019 13:38
ObiWahn added a commit that referenced this pull request Oct 23, 2019
…ture/upgrade-v8

* 'devel' of https://github.com/arangodb/arangodb:
  updated CHANGELOG
  upgrade boost to version 1.71.0 (#10299)
  Feature/explain spliced subqueries (#10298)
  Revert "Feature/react webpack testing (#8712)"
  Feature/react webpack testing (#8712)
  Bug fix/make result ctor noexcept (#10293)
  micro optimizations for case conversion (#10291)
  fix error message (#10281)
  Add Linux to -Werr (#10294)
ObiWahn added a commit that referenced this pull request Oct 23, 2019
…ture/smart-join-views-2

* 'devel' of https://github.com/arangodb/arangodb: (24 commits)
  url-encode and -decode in place (#10301)
  updated CHANGELOG
  upgrade boost to version 1.71.0 (#10299)
  Feature/explain spliced subqueries (#10298)
  Revert "Feature/react webpack testing (#8712)"
  Feature/react webpack testing (#8712)
  Bug fix/make result ctor noexcept (#10293)
  micro optimizations for case conversion (#10291)
  fix error message (#10281)
  Add Linux to -Werr (#10294)
  make sure error files get built when arangod is built (#10284)
  reactivate warnings as errors (#10286)
  remove extra JSON parser (#10282)
  don't show "NaN" in web interface for cluster RAM usage (#10283)
  Bug fix/some future massaging (#10285)
  pacify Valgrind on shutdown
  use C++17 [[fallthrough]] (#10280)
  Remove accidentally committed file
  Try to use gcc 9.2.0 (#10277)
  Revert "Try to use gcc 9.2.0"
  ...
ObiWahn added a commit that referenced this pull request Oct 24, 2019
…ture/cpp17-clean-up

* 'devel' of https://github.com/arangodb/arangodb:
  make ccache optional (#10310)
  abort write transactions (#10248)
  url-encode and -decode in place (#10301)
  updated CHANGELOG
  upgrade boost to version 1.71.0 (#10299)
  Feature/explain spliced subqueries (#10298)
  Revert "Feature/react webpack testing (#8712)"
  Feature/react webpack testing (#8712)
  Bug fix/make result ctor noexcept (#10293)
  micro optimizations for case conversion (#10291)
  fix error message (#10281)
  Add Linux to -Werr (#10294)
  make sure error files get built when arangod is built (#10284)
ObiWahn added a commit that referenced this pull request Oct 25, 2019
…ture/switch-some-scripts-to-python3

* 'devel' of https://github.com/arangodb/arangodb: (26 commits)
  upgrade vpack library (#10314)
  avoid string copies in several cases (#10317)
  Round index estimates when comparing plan, we do not really care for exact equallity, they should only not be off by much (#10312)
  make ccache optional (#10310)
  abort write transactions (#10248)
  url-encode and -decode in place (#10301)
  updated CHANGELOG
  upgrade boost to version 1.71.0 (#10299)
  Feature/explain spliced subqueries (#10298)
  Revert "Feature/react webpack testing (#8712)"
  Feature/react webpack testing (#8712)
  Bug fix/make result ctor noexcept (#10293)
  micro optimizations for case conversion (#10291)
  fix error message (#10281)
  Add Linux to -Werr (#10294)
  make sure error files get built when arangod is built (#10284)
  reactivate warnings as errors (#10286)
  remove extra JSON parser (#10282)
  don't show "NaN" in web interface for cluster RAM usage (#10283)
  Bug fix/some future massaging (#10285)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0