Skip to content

Commit 86ae524

Browse files
steveburnetttdcmeehan
authored andcommitted
Add documentation for query plan and plan fragment
1 parent 90742a4 commit 86ae524

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

presto-docs/src/main/sphinx/overview/concepts.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,33 @@ that statement. A query encompasses stages, tasks, splits, connectors,
183183
and other components and data sources working in concert to produce a
184184
result.
185185

186+
Query Plan
187+
^^^^^^^^^^
188+
189+
A query plan is a sequence of steps used to access and manipulate data
190+
according to the SQL query. It is represented as a tree of nodes, with
191+
each node loosely representing an `operator <https://prestodb.io/docs/current/overview/concepts.html#operator>`_.
192+
Since SQL is declarative, multiple query plans can be generated to execute
193+
a given query. Because query plans can have different performance behavior,
194+
Presto uses a query optimizer to choose an efficient plan.
195+
196+
There are two phases of optimization: logical and physical. The logical
197+
phase of optimization transforms plans by only considering algorithmic
198+
complexity. The logically optimized query plan is then converted into
199+
a physical query plan, which is optimized for distributed execution and
200+
includes details such as the number and
201+
`types <https://prestodb.io/docs/current/overview/concepts.html#server-types>`_
202+
of Presto servers which should process a query plan node, and how data is
203+
`exchanged <https://prestodb.io/docs/current/overview/concepts.html#exchange>`_
204+
between them.
205+
206+
Plan Fragment
207+
^^^^^^^^^^^^^
208+
209+
A plan fragment is a section of the physical query plan executed by
210+
`tasks <https://prestodb.io/docs/current/overview/concepts.html#task>`_ on different
211+
`Presto servers <https://prestodb.io/docs/current/overview/concepts.html#server-types>`_.
212+
186213
Stage
187214
^^^^^
188215

presto-docs/src/main/sphinx/sql/explain.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Description
2020
-----------
2121

2222
Show the logical or distributed execution plan of a statement, or validate the statement.
23-
Use ``TYPE DISTRIBUTED`` option to display fragmented plan. Each plan fragment is executed by
24-
a single or multiple Presto nodes. Fragments separation represent the data exchange between Presto nodes.
25-
Fragment type specifies how the fragment is executed by Presto nodes and how the data is
26-
distributed between fragments:
23+
Use ``TYPE DISTRIBUTED`` option to display fragmented plan. Each
24+
`plan fragment <https://prestodb.io/docs/current/overview/concepts.html#plan-fragment>`_
25+
is executed by a single or multiple Presto nodes. Fragment type specifies how the fragment
26+
is executed by Presto nodes and how the data is distributed between fragments:
2727

2828
``SINGLE``
2929
Fragment is executed on a single node.

0 commit comments

Comments
 (0)