select first_name,last_name,department_number from employee where employ
ee.department_number IN (select department_number from department where departme nt_name LIKE 'research%'); Explanation --------------------------------------------------------------------------1) First, we lock a distinct CUSTOMER_SERVICE."pseudo table" for read on a RowHash to prevent global deadlock for CUSTOMER_SERVICE.employee. 2) Next, we lock a distinct CUSTOMER_SERVICE."pseudo table" for read on a RowHash to prevent global deadlock for CUSTOMER_SERVICE.department. 3) We lock CUSTOMER_SERVICE.employee for read, and we lock CUSTOMER_SERVICE.department for read. 4) We do an all-AMPs RETRIEVE step from CUSTOMER_SERVICE.employee by way of an all-rows scan with no residual conditions into Spool 2 (all_amps), which is redistributed by the hash code of ( CUSTOMER_SERVICE.employee.department_number) to all AMPs. Then we do a SORT to order Spool 2 by row hash. The size of Spool 2 is estimated with low confidence to be 28 rows (1,372 bytes). The estimated time for this step is 0.01 seconds. 5) We do an all-AMPs JOIN step from Spool 2 (Last Use) by way of an all-rows scan, which is joined to CUSTOMER_SERVICE.department by way of an all-rows scan with a condition of ( "CUSTOMER_SERVICE.department.department_name LIKE 'research%'"). Spool 2 and CUSTOMER_SERVICE.department are joined using an inclusion merge join, with a join condition of ( "department_number = CUSTOMER_SERVICE.department.department_number"). The result goes into Spool 1 (group_amps), which is built locally on the AMPs. The size of Spool 1 is estimated with no confidence to be 26 rows (2,132 bytes). The estimated time for this step is 0.05 seconds. 6) 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.07 seconds. EXPLAIN sel e.first_name(char(10)),e.last_name(char(10)),m.first_name(char( 10)),m.last_name(char(10)) from employee e JOIN employee m ON e.manager_e mployee_number = m.employee_number where e.last_name='Brown'; EXPLAIN select e.first_name,e.last_name,e.department_number from employee e INNER JOIN department d ON e.department_number=d.department_number WHERE d.department_name LIKE 'research%'; Explanation --------------------------------------------------------------------------1) First, we lock a distinct CUSTOMER_SERVICE."pseudo table" for read on a RowHash to prevent global deadlock for CUSTOMER_SERVICE.e. 2) Next, we lock a distinct CUSTOMER_SERVICE."pseudo table" for read on a RowHash to prevent global deadlock for CUSTOMER_SERVICE.d. 3) We lock CUSTOMER_SERVICE.e for read, and we lock CUSTOMER_SERVICE.d for read. 4) We do an all-AMPs RETRIEVE step from CUSTOMER_SERVICE.e by way of an all-rows scan with a condition of ("NOT (CUSTOMER_SERVICE.e.department_number IS NULL)") into Spool 2
(all_amps), which is redistributed by the hash code of (
CUSTOMER_SERVICE.e.department_number) to all AMPs. Then we do a SORT to order Spool 2 by row hash. The size of Spool 2 is estimated with low confidence to be 28 rows (1,372 bytes). The estimated time for this step is 0.01 seconds. 5) We do an all-AMPs JOIN step from CUSTOMER_SERVICE.d by way of a RowHash match scan with a condition of ( "CUSTOMER_SERVICE.d.department_name LIKE 'research%'"), which is joined to Spool 2 (Last Use) by way of a RowHash match scan. CUSTOMER_SERVICE.d and Spool 2 are joined using a merge join, with a join condition of ("department_number = CUSTOMER_SERVICE.d.department_number"). The result goes into Spool 1 (group_amps), which is built locally on the AMPs. The size of Spool 1 is estimated with no confidence to be 26 rows ( 2,132 bytes). The estimated time for this step is 0.05 seconds. 6) 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.07 seconds.