• Sequence of operation which will be performed to retrieve the query results
  • Adding EXPLAIN keyword before the query and executing it, will show the Query Plan
  • EXPLAIN framework prints the PLANNED STATEMENT in a user-friendly output
  • EXPLAIN will not run the query, but will only show the plan.
  • The below query plan indicates 2 operation
    Step 1) Seq Scan --> The Table foo will be scanned on all the Segments
    Step 2) Gather Motion --> All the scanned data in Step 1 will be Gathered at Master
EXPLAIN SELECT * FROM foo;
                                  QUERY PLAN
-------------------------------------------------------------------------------
 Gather Motion 2:1  (slice1; segments: 2)  (cost=0.00..431.00 rows=2 width=12)
   ->  Seq Scan on foo  (cost=0.00..431.00 rows=1 width=12)

ORCA优化器浅析——What is a Query Plan_数据库

What is a high level flow for a query?

ORCA优化器浅析——What is a Query Plan_数据库_02