-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathexplain.html
172 lines (155 loc) · 7.53 KB
/
explain.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>8.14. EXPLAIN — Presto 0.184 Documentation</title>
<link rel="stylesheet" href="../_static/presto.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.184',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="top" title="Presto 0.184 Documentation" href="../index.html" />
<link rel="up" title="8. SQL Statement Syntax" href="../sql.html" />
<link rel="next" title="8.15. EXPLAIN ANALYZE" href="explain-analyze.html" />
<link rel="prev" title="8.13. DROP VIEW" href="drop-view.html" />
</head>
<body role="document">
<div class="header">
<h1 class="heading"><a href="../index.html">
<span>Presto 0.184 Documentation</span></a></h1>
<h2 class="heading"><span>8.14. EXPLAIN</span></h2>
</div>
<div class="topnav">
<p class="nav">
<span class="left">
« <a href="drop-view.html">8.13. DROP VIEW</a>
</span>
<span class="right">
<a href="explain-analyze.html">8.15. EXPLAIN ANALYZE</a> »
</span>
</p>
</div>
<div class="content">
<div class="section" id="explain">
<h1>8.14. EXPLAIN</h1>
<div class="section" id="synopsis">
<h2>Synopsis</h2>
<div class="highlight-none"><div class="highlight"><pre><span></span>EXPLAIN [ ( option [, ...] ) ] statement
where option can be one of:
FORMAT { TEXT | GRAPHVIZ }
TYPE { LOGICAL | DISTRIBUTED | VALIDATE }
</pre></div>
</div>
</div>
<div class="section" id="description">
<h2>Description</h2>
<p>Show the logical or distributed execution plan of a statement, or validate the statement.
Use <code class="docutils literal"><span class="pre">TYPE</span> <span class="pre">DISTRIBUTED</span></code> option to display fragmented plan. Each plan fragment is executed by
a single or multiple Presto nodes. Fragments separation represent the data exchange between Presto nodes.
Fragment type specifies how the fragment is executed by Presto nodes and how the data is
distributed between fragments:</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">SINGLE</span></code></dt>
<dd>Fragment is executed on a single node.</dd>
<dt><code class="docutils literal"><span class="pre">HASH</span></code></dt>
<dd>Fragment is executed on a fixed number of nodes with the input data
distributed using a hash function.</dd>
<dt><code class="docutils literal"><span class="pre">ROUND_ROBIN</span></code></dt>
<dd>Fragment is executed on a fixed number of nodes with the input data
distributed in a round-robin fashion.</dd>
<dt><code class="docutils literal"><span class="pre">BROADCAST</span></code></dt>
<dd>Fragment is executed on a fixed number of nodes with the input data
broadcasted to all nodes.</dd>
<dt><code class="docutils literal"><span class="pre">SOURCE</span></code></dt>
<dd>Fragment is executed on nodes where input splits are accessed.</dd>
</dl>
</div>
<div class="section" id="examples">
<h2>Examples</h2>
<p>Logical plan:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>presto:tiny> EXPLAIN SELECT regionkey, count(*) FROM nation GROUP BY 1;
Query Plan
----------------------------------------------------------------------------------------------------------
- Output[regionkey, _col1] => [regionkey:bigint, count:bigint]
_col1 := count
- RemoteExchange[GATHER] => regionkey:bigint, count:bigint
- Aggregate(FINAL)[regionkey] => [regionkey:bigint, count:bigint]
count := "count"("count_8")
- LocalExchange[HASH][$hashvalue] ("regionkey") => regionkey:bigint, count_8:bigint, $hashvalue:bigint
- RemoteExchange[REPARTITION][$hashvalue_9] => regionkey:bigint, count_8:bigint, $hashvalue_9:bigint
- Project[] => [regionkey:bigint, count_8:bigint, $hashvalue_10:bigint]
$hashvalue_10 := "combine_hash"(BIGINT '0', COALESCE("$operator$hash_code"("regionkey"), 0))
- Aggregate(PARTIAL)[regionkey] => [regionkey:bigint, count_8:bigint]
count_8 := "count"(*)
- TableScan[tpch:tpch:nation:sf0.1, originalConstraint = true] => [regionkey:bigint]
regionkey := tpch:regionkey
</pre></div>
</div>
<p>Distributed plan:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>presto:tiny> EXPLAIN (TYPE DISTRIBUTED) SELECT regionkey, count(*) FROM nation GROUP BY 1;
Query Plan
----------------------------------------------------------------------------------------------
Fragment 0 [SINGLE]
Output layout: [regionkey, count]
Output partitioning: SINGLE []
- Output[regionkey, _col1] => [regionkey:bigint, count:bigint]
_col1 := count
- RemoteSource[1] => [regionkey:bigint, count:bigint]
Fragment 1 [HASH]
Output layout: [regionkey, count]
Output partitioning: SINGLE []
- Aggregate(FINAL)[regionkey] => [regionkey:bigint, count:bigint]
count := "count"("count_8")
- LocalExchange[HASH][$hashvalue] ("regionkey") => regionkey:bigint, count_8:bigint, $hashvalue:bigint
- RemoteSource[2] => [regionkey:bigint, count_8:bigint, $hashvalue_9:bigint]
Fragment 2 [SOURCE]
Output layout: [regionkey, count_8, $hashvalue_10]
Output partitioning: HASH [regionkey][$hashvalue_10]
- Project[] => [regionkey:bigint, count_8:bigint, $hashvalue_10:bigint]
$hashvalue_10 := "combine_hash"(BIGINT '0', COALESCE("$operator$hash_code"("regionkey"), 0))
- Aggregate(PARTIAL)[regionkey] => [regionkey:bigint, count_8:bigint]
count_8 := "count"(*)
- TableScan[tpch:tpch:nation:sf0.1, originalConstraint = true] => [regionkey:bigint]
regionkey := tpch:regionkey
</pre></div>
</div>
<p>Validate:</p>
<div class="highlight-none"><div class="highlight"><pre><span></span>presto:tiny> EXPLAIN (TYPE VALIDATE) SELECT regionkey, count(*) FROM nation GROUP BY 1;
Valid
-------
true
</pre></div>
</div>
</div>
<div class="section" id="see-also">
<h2>See Also</h2>
<p><a class="reference internal" href="explain-analyze.html"><span class="doc">EXPLAIN ANALYZE</span></a></p>
</div>
</div>
</div>
<div class="bottomnav">
<p class="nav">
<span class="left">
« <a href="drop-view.html">8.13. DROP VIEW</a>
</span>
<span class="right">
<a href="explain-analyze.html">8.15. EXPLAIN ANALYZE</a> »
</span>
</p>
</div>
<div class="footer" role="contentinfo">
</div>
</body>
</html>