From d6586f3bae5780f3a88d5c2318728bca09eef1f4 Mon Sep 17 00:00:00 2001 From: Heidi Han Date: Thu, 19 Feb 2026 18:10:28 -0800 Subject: [PATCH 1/2] docs: Add CREATE/DROP TABLE docs to sql/explain.rst Summary: as title. Differential Revision: D93814964 --- presto-docs/src/main/sphinx/sql/explain.rst | 48 +++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/presto-docs/src/main/sphinx/sql/explain.rst b/presto-docs/src/main/sphinx/sql/explain.rst index 1b541b1d82e9a..6d0e28126d61f 100644 --- a/presto-docs/src/main/sphinx/sql/explain.rst +++ b/presto-docs/src/main/sphinx/sql/explain.rst @@ -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 `_ -is executed by a single or multiple Presto nodes. Fragment type specifies how the fragment +Use ``TYPE DISTRIBUTED`` option to display fragmented plan. Each +`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`` @@ -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 -------- From 2e4d679477aad6071037de8fde694c4d74bfda40 Mon Sep 17 00:00:00 2001 From: HeidiHan0000 <44453261+HeidiHan0000@users.noreply.github.com> Date: Fri, 20 Feb 2026 11:59:25 -0800 Subject: [PATCH 2/2] Address comment Co-authored-by: Steve Burnett --- presto-docs/src/main/sphinx/sql/explain.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presto-docs/src/main/sphinx/sql/explain.rst b/presto-docs/src/main/sphinx/sql/explain.rst index 6d0e28126d61f..dc5cf1339fd4e 100644 --- a/presto-docs/src/main/sphinx/sql/explain.rst +++ b/presto-docs/src/main/sphinx/sql/explain.rst @@ -20,7 +20,7 @@ Description ----------- Show the logical or distributed execution plan of a statement, or validate the statement. -Use ``TYPE DISTRIBUTED`` option to display fragmented plan. Each +Use ``TYPE DISTRIBUTED`` option to display a fragmented plan. Each `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: