whitestorm
Technical User
Dear All,
When I created a macro (see below, ttemp.test_mac, DB Version: "RELEASE V2R.05.00.02.03,VERSION
05.00.02.06") and ran this macro, a strange thing happened! The inserted rows of "exec ttemp.test_mac" ARE "2", NOT "3"!! AND, There is only one "SAMPLING" in the EXPLANATION.
Does anybody know why?
Best Regard.
========== DDL ==========
CREATE SET TABLE ttemp.t2 ,NO FALLBACK ,NO BEFORE JOURNAL,NO AFTER JOURNAL
(c1 INTEGER,c2 INTEGER) PRIMARY INDEX (c1 );
/*There are 5 records in this table*/
CREATE MULTISET TABLE ttemp.t1 ,NO FALLBACK ,NO BEFORE JOURNAL, NO AFTER JOURNAL
(c1 INTEGER)PRIMARY INDEX ( c1 );
create macro ttemp.test_mac as
(
ins into ttemp.t1 sel 1 from ttemp.t2 sample 1;
/*sample 1 from 5 records*/
ins into ttemp.t1 sel 2 from ttemp.t2 sample 2;
/*sample 2 from 5 recodes*/
);
========== Explanation ==========
1) First, we lock a distinct ttemp."pseudo table" for write on a
RowHash to prevent global deadlock for ttemp.t1.
2) Next, we lock a distinct ttemp."pseudo table" for read on a
RowHash to prevent global deadlock for ttemp.t2.
3) We lock ttemp.t1 for write, and we lock ttemp.t2 for read.
4) We do an all-AMPs RETRIEVE step from ttemp.t2 by way of an
all-rows scan with no residual conditions into Spool 3 (Last Use),
which is redistributed by hash code to all AMPs. The size of
Spool 3 (Last Use) is estimated with low confidence to be 76 rows.
The estimated time for this step is 0.56 seconds.
5) We do an all-AMPs SAMPLING step from ttemp.t2 by way of an
all-rows scan with no residual conditions into Spool 1 (all_amps),
which is redistributed by hash code to all AMPs. Samples are
specified as a number of rows.
6) We do a SORT to order Spool 1 by row hash.
7) We do an all-AMPs MERGE into ttemp.t1 from Spool 1 (Last Use).
8) 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.
When I created a macro (see below, ttemp.test_mac, DB Version: "RELEASE V2R.05.00.02.03,VERSION
05.00.02.06") and ran this macro, a strange thing happened! The inserted rows of "exec ttemp.test_mac" ARE "2", NOT "3"!! AND, There is only one "SAMPLING" in the EXPLANATION.
Does anybody know why?
Best Regard.
========== DDL ==========
CREATE SET TABLE ttemp.t2 ,NO FALLBACK ,NO BEFORE JOURNAL,NO AFTER JOURNAL
(c1 INTEGER,c2 INTEGER) PRIMARY INDEX (c1 );
/*There are 5 records in this table*/
CREATE MULTISET TABLE ttemp.t1 ,NO FALLBACK ,NO BEFORE JOURNAL, NO AFTER JOURNAL
(c1 INTEGER)PRIMARY INDEX ( c1 );
create macro ttemp.test_mac as
(
ins into ttemp.t1 sel 1 from ttemp.t2 sample 1;
/*sample 1 from 5 records*/
ins into ttemp.t1 sel 2 from ttemp.t2 sample 2;
/*sample 2 from 5 recodes*/
);
========== Explanation ==========
1) First, we lock a distinct ttemp."pseudo table" for write on a
RowHash to prevent global deadlock for ttemp.t1.
2) Next, we lock a distinct ttemp."pseudo table" for read on a
RowHash to prevent global deadlock for ttemp.t2.
3) We lock ttemp.t1 for write, and we lock ttemp.t2 for read.
4) We do an all-AMPs RETRIEVE step from ttemp.t2 by way of an
all-rows scan with no residual conditions into Spool 3 (Last Use),
which is redistributed by hash code to all AMPs. The size of
Spool 3 (Last Use) is estimated with low confidence to be 76 rows.
The estimated time for this step is 0.56 seconds.
5) We do an all-AMPs SAMPLING step from ttemp.t2 by way of an
all-rows scan with no residual conditions into Spool 1 (all_amps),
which is redistributed by hash code to all AMPs. Samples are
specified as a number of rows.
6) We do a SORT to order Spool 1 by row hash.
7) We do an all-AMPs MERGE into ttemp.t1 from Spool 1 (Last Use).
8) 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.