As output #1 below shows, Dieter is right: the macro does a fast-path insert/select. I think, however, that this must be a special
optimization for this one case. In general, it would not be possible to execute every statement in a macro "in parallel". In output #2, I
show an example: a select followed by an insert. Here the select must happen either before or after the insert. Fortunately, it happens
just where you would expct it.

First, we lock a distinct lci_dw_tbls."pseudo table" for read on a RowHash to prevent global deadlock for
lci_dw_tbls.npmatvi_hvac_sl_prd.

2)

Next, we lock a distinct LCIDBA."pseudo table" for write on a RowHash to prevent global deadlock for LCIDBA.tab1.

3)

We lock lci_dw_tbls.npmatvi_hvac_sl_prd for read, and we lock LCIDBA.tab1 for write.

4)

We do a single-AMP RETRIEVE step from lci_dw_tbls.npmatvi_hvac_sl_prd by way of the unique primary index
"lci_dw_tbls.npmatvi_hvac_sl_prd.hvac_sl_prd_id_no = 644838" with no residual conditions into Spool 1, which is built locally on that AMP.
The size of Spool 1 is estimated with high confidence to be 1 row. The estimated time for this step is 0.15 seconds.

5)

We do an all-AMPs RETRIEVE step from lci_dw_tbls.npmatvi_hvac_sl_prd by way of an all-rows scan with a condition of
("lci_dw_tbls.npmatvi_hvac_sl_prd.hvac_sl_prd_id_no <> 644838") into Spool 1, which is built locally on the AMPs. The size of Spool 1 is
estimated with high confidence to be 900,644 rows. The estimated time for this step is 1.42 seconds.

6)

We do a SORT to order Spool 1 by row hash.

7)

We do a MERGE into LCIDBA.tab1 from Spool 1 (Last Use).

8)

We spoil the parser's dictionary cache for the table.

9)

Finally, we send out an END TRANSACTION step to all AMPs involved in processing the request.

->

No rows are returned to the user as the result of statement 1. No rows are returned to the user as the result of statement 2.

We do an all-AMPs RETRIEVE step from lci_dw_tbls.npmatvi_hvac_sl_prd by way of an all-rows scan with a condition of
("lci_dw_tbls.npmatvi_hvac_sl_prd.hvac_sl_prd_id_no <> 644838") into Spool 1, which is built locally on the AMPs. The size of Spool 1 is
estimated with high confidence to be 900,644 rows. The estimated time for this step is 1.42 seconds.

First, we lock a distinct LCIDBA."pseudo table" for read on a RowHash to prevent global deadlock for LCIDBA.tab2.

2)

Next, we lock LCIDBA.tab2 for read.

3)

We do an all-AMPs RETRIEVE step from LCIDBA.tab2 by way of an all-rows scan with no residual conditions into Spool 1, which is built
locally on the AMPs. The size of Spool 1 is estimated with low confidence to be 320 rows. The estimated time for this step is 0.15
seconds.

4)

We do an INSERT into LCIDBA.tab2.

5)

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. No rows are returned to the user as the result of
statement 2.