Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

EXPLAIN

Explains your executions steps

Explain? whats that?


A keyword. Main benefits Thats means---its a good way to learn about system

Where it comes from?

Optimizer needs info about: 1)TD configuration environment 2)Data demographics

Simplest Example
EXPLAIN SEL * FROM customer WHERE customer_number=2100;
1) First, we do a single-AMP RETRIEVE step from STUDENTS.customer by way of the unique primary index "STUDENTS.customer.Customer_Number = 2100" with no residual conditions. The estimated time for this step is 0.01 seconds. -> The row is sent directly back to the user as the result of statement 1. The total estimated time is 0.01 seconds.

BUT IF

EXPLAIN SEL * FROM customer;

1) First, we lock a distinct STUDENTS."pseudo table" for read on a RowHash to prevent global deadlock for STUDENTS.customer. 2) Next, we lock STUDENTS.customer for read. 3) We do an all-AMPs RETRIEVE step from STUDENTS.customer by way of an all-rows scan with no residual conditions into Spool 1 (all_amps), which is built locally on the AMPs. The size of Spool 1 is estimated with low confidence to be 202 rows (15,958 bytes). The estimated time for this step is 0.03 seconds. 4) Finally, we send out an END TRANSACTION step to all AMPs involved in processing the request. -> The contents of Spool 1 are sent back to the user as the result of statement 1. The total estimated time is 0.03 seconds.

Some key statements


... Pseudo Table Locks

... (Last Use)


... with no residual conditions ... END TRANSACTION ... by way of the sort key in spool field1 (dbname.tablename.colname) ... We do an ABORT test ... We execute the following steps in parallel...

Cont
... which is redistributed by hash code to all AMPs (dbname.tablename.colname)

... which is duplicated on all AMPs


... (one_amp) or (group_amps) or (all_amps) ... ("NOT (table_name.column_name IS NULL)") ... eliminating duplicate rows ... we do SMS(set manipulation steps) ... we do a BMSMS (bit map set manipulation step)

Cont
. . . with high confidence . . . . . . with low confidence . . . . . . with no confidence . . . . . . with index join confidence . . .

Explaining CREATE

Explaining macros

Contd
EXPLAIN USING (dept_no INTEGER) EXECUTE Dept_List (:dept_no);
1) First, we lock a distinct MyDB."pseudo table" for read on a RowHash to prevent global deadlock for MyDB.Employee. 2) 2) Next, we lock MyDB.Employee for read. 3) 3) We do an all-AMPs RETRIEVE step from MyDB.Employee by way of an allrows scan with a condition of ("MyDB.Employee.Dept_Number = :dept_no") into Spool 1 (group_amps), which is built locally on the AMPs. The size of Spool 1 is estimated with low confidence to be 19 rows (1,463 bytes). The estimated time for this step is 0.02 seconds. 4) 4) Finally, we send out an END TRANSACTION step to all AMPs involved in processing the request. -> The contents of Spool 1 are sent back to the user as the result of statement 1. The total estimated time is 0.02 seconds.

Some PPI Terminologies


a single partition of or n partitions of SORT to partition Spool m by rowkey a rowkey-based enhanced by dynamic partition

PPI vs. NPPI

You might also like