Professional Documents
Culture Documents
Explain Facility at Teradata For A Query
Explain Facility at Teradata For A Query
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
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.
Cont
... which is redistributed by hash code to all AMPs (dbname.tablename.colname)
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.