Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions presto-docs/src/main/sphinx/sql/explain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Description
-----------

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

``SINGLE``
Expand Down Expand Up @@ -152,6 +152,48 @@ IO:
}
}

DDL Statements
^^^^^^^^^^^^^^

``EXPLAIN`` can also be used with DDL statements such as ``CREATE TABLE`` and ``DROP TABLE``.
For these statements, the output shows a summary of the operation rather than an execution plan.

CREATE TABLE:

.. code-block:: none

presto:tiny> EXPLAIN CREATE TABLE new_table (id BIGINT, name VARCHAR);
Query Plan
--------------------------
CREATE TABLE new_table

CREATE TABLE IF NOT EXISTS:

.. code-block:: none

presto:tiny> EXPLAIN CREATE TABLE IF NOT EXISTS new_table (id BIGINT, name VARCHAR);
Query Plan
--------------------------------------
CREATE TABLE IF NOT EXISTS new_table

DROP TABLE:

.. code-block:: none

presto:tiny> EXPLAIN DROP TABLE test_table;
Query Plan
--------------------------------------------------------------
DROP TABLE test_table

DROP TABLE IF EXISTS:

.. code-block:: none

presto:tiny> EXPLAIN DROP TABLE IF EXISTS test_table;
Query Plan
--------------------------------------------------------------
DROP TABLE IF EXISTS test_table


See Also
--------
Expand Down
Loading