-- @@@ START COPYRIGHT @@@
--
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements.  See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership.  The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License.  You may obtain a copy of the License at
--
--   http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied.  See the License for the
-- specific language governing permissions and limitations
-- under the License.
--
-- @@@ END COPYRIGHT @@@
-- @@@ START COPYRIGHT @@@
--
>>-- Run Tests
>>	set schema cat.tpcd;

--- SQL operation complete.
>>	obey TESTMV215B(TEST1);
>>set schema cat.tpcdRI;

--- SQL operation complete.
>>log LOGMV215B;
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>
>>-- Basic Q5
>>-- for compare 
>>
>>PREPARE stat1 FROM 
+>	select n_name, sum(l_extendedprice*(1-l_discount)) as revenue,count(*) rows_in_group
+>	from customer,orders,lineitem,supplier,nation, region
+>	where
+>	    c_custkey = o_custkey
+>	    and o_orderkey = l_orderkey
+>	    and l_suppkey = s_suppkey
+>	    and c_nationkey= s_nationkey
+>	    and s_nationkey = n_nationkey
+>	    and n_regionkey = r_regionkey
+>	    and r_name in ('ASIA','AMERICA','EUROPE','MIDDLE EAST','AFRICA')
+>	    and o_orderdate >= date '1994-01-01'
+>	    and o_orderdate < date '1994-01-01' + interval '3' year
+>	group by n_name
+>	order by n_name,revenue desc ;

--- SQL command prepared.
>>
>>PREPARE stat2 FROM 
+>	select n_name,revenue,rows_in_group
+>	from mv4q5 
+>	order by n_name,revenue desc;

--- SQL command prepared.
>>
>>log;
1,2c1,2
< >>  log TEMP1;
< >>  execute stat1;
---
> >>  log TEMP2;
> >>  execute stat2;
>>
>>
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>
>>
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.supplier@ @0@ @200@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.customer@ @0@ @200@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.part@ @0@ @200@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.partsupp@ @0@ @200@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.lineitem@ @0@ @200@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.orders@ @0@ @200@ ;

--- SQL operation complete.
>>
>>SET PARAM ?part_key_down  '1000';
>>SET PARAM ?part_key_up    '1300';
>>
>>SET PARAM ?supp_key_down  '40';
>>SET PARAM ?supp_key_up    '70';
>>
>>SET PARAM ?cust_key_down  '300';
>>SET PARAM ?cust_key_up    '600';
>>
>>SET PARAM ?order_key_down '15000';
>>SET PARAM ?order_key_up   '20000';
>>
>>-- *************************** Due to a bug in the prepare statement we copied the section ***************
>>
>>
>>PREPARE insert_supplier FROM
+>insert into tpcdRI.supplier
+>select *
+>from tpcd.supplier supplier
+>where s_suppkey >= ?supp_key_down and
+>      s_suppkey < ?supp_key_up
+>order by s_suppkey;

--- SQL command prepared.
>>
>>
>>PREPARE insert_part FROM
+>insert into tpcdRI.part
+>select *
+>from tpcd.part 
+>where p_partkey >= ?part_key_down and
+>      p_partkey < ?part_key_up
+>order by p_partkey;

--- SQL command prepared.
>>
>>PREPARE insert_customer FROM
+>insert into tpcdRI.customer
+>select *
+>from tpcd.customer
+>where c_custkey >= ?cust_key_down and
+>      c_custkey < ?cust_key_up
+>order by c_custkey;

--- SQL command prepared.
>>
>>PREPARE insert_orders FROM
+>insert into tpcdRI.orders
+>select *
+>from tpcd.orders 
+>where o_orderkey >= ?order_key_down and
+>      o_orderkey < ?order_key_up 
+>order by o_orderkey;

--- SQL command prepared.
>>
>>
>>PREPARE insert_partsupp FROM
+>insert into tpcdRI.partsupp
+>select *
+>from tpcd.partsupp
+>where ps_partkey in ( select p_partkey from tpcdRI.part) and
+>      ps_suppkey in ( select s_suppkey from tpcdRI.supplier) and
+>      ps_partkey,ps_suppkey not in (select * from tpcdRI.t1)
+>order by ps_partkey,ps_suppkey;

--- SQL command prepared.
>>
>>
>>PREPARE insert_lineitem FROM
+>insert into tpcdRI.lineitem
+>select *
+>from tpcd.lineitem
+>where l_partkey,l_suppkey in 
+>           ( select ps_partkey,ps_suppkey from tpcdRI.partsupp) and
+>	  l_orderkey in ( select o_orderkey from tpcdRI.orders) and
+>	  l_orderkey,l_linenumber not in (select * from tpcdRI.t1)
+>order by l_orderkey,l_linenumber;

--- SQL command prepared.
>>
>>obey TESTMV215B(LOAD_DELTA);
>>-- This section performs the load of data specified by the Deltas
>>-- while keeping RI
>>
>>set schema cat.tpcd;

--- SQL operation complete.
>>-- ---------------------
>>execute insert_supplier;

--- 30 row(s) inserted.
>>-- ---------------------
>>execute insert_part;

--- 300 row(s) inserted.
>>-- ---------------------
>>execute insert_customer;

--- 300 row(s) inserted.
>>-- ---------------------
>>delete from tpcdRI.t1;

--- 0 row(s) deleted.
>>insert into tpcdRI.t1
+>  select c_custkey,0 from tpcdRI.customer;

--- 599 row(s) inserted.
>>execute insert_orders;

--- 581 row(s) inserted.
>>-- ---------------------
>>delete from tpcdRI.t1;

--- 599 row(s) deleted.
>>insert into tpcdRI.t1
+>  select ps_partkey,ps_suppkey from tpcdRI.partsupp;

--- 1557 row(s) inserted.
>>execute insert_partsupp;

--- 2028 row(s) inserted.
>>-- ---------------------
>>delete from tpcdRI.t1;

--- 1557 row(s) deleted.
>>insert into tpcdRI.t1
+>  select l_orderkey,l_linenumber from tpcdRI.lineitem;

--- 803 row(s) inserted.
>>execute insert_lineitem;

--- 1909 row(s) inserted.
>>-- ---------------------
>>set schema cat.tpcdRI;

--- SQL operation complete.
>>
>>
>>
>>
>>
>>--------------------------------------------------------------
>>
>>
>>
>>-----------------------------------------------  End preparation -----------------------------------------------
>>
>>-- Basic Q5
>>-- internal refresh with insert delta for all tables
>>
>>refresh mv4q5 debug 51;

--- SQL operation complete.
>>log;

 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.REGION)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 101;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.NATION)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 102;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.ORDERS)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 200;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.LINEITEM)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 200;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.SUPPLIER)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 200;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.CUSTOMER)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 200;
The materialized view CAT.TPCDRI.MV4Q5 is being refreshed in a single transaction...

 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 101 AND 200 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 101 AND 200 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 101 AND 200 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 101 AND 200 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 0 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 101 AND 200 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 101 AND 200 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 101 AND 200 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 101 AND 200 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 1 
The materialized view CAT.TPCDRI.MV4Q5 has been refreshed (in 2 phases) in a single transaction.

Starting the log cleanup of table CAT.TPCDRI.REGION...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.REGION)
WHERE
("@EPOCH" BETWEEN 101 AND 101)
OR
("@EPOCH" BETWEEN -101 AND 0);
Finished the log cleanup of table CAT.TPCDRI.REGION.

Starting the log cleanup of table CAT.TPCDRI.NATION...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.NATION)
WHERE
("@EPOCH" BETWEEN 101 AND 101)
OR
("@EPOCH" BETWEEN -101 AND 0);
Finished the log cleanup of table CAT.TPCDRI.NATION.

Starting the log cleanup of table CAT.TPCDRI.ORDERS...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.ORDERS)
WHERE
("@EPOCH" BETWEEN 101 AND 101)
OR
("@EPOCH" BETWEEN -101 AND 0);
Finished the log cleanup of table CAT.TPCDRI.ORDERS.

Starting the log cleanup of table CAT.TPCDRI.LINEITEM...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.LINEITEM)
WHERE
("@EPOCH" BETWEEN 101 AND 101)
OR
("@EPOCH" BETWEEN -101 AND 0);
Finished the log cleanup of table CAT.TPCDRI.LINEITEM.

Starting the log cleanup of table CAT.TPCDRI.SUPPLIER...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.SUPPLIER)
WHERE
("@EPOCH" BETWEEN 101 AND 101)
OR
("@EPOCH" BETWEEN -101 AND 0);
Finished the log cleanup of table CAT.TPCDRI.SUPPLIER.

Starting the log cleanup of table CAT.TPCDRI.CUSTOMER...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.CUSTOMER)
WHERE
("@EPOCH" BETWEEN 101 AND 200)
OR
("@EPOCH" BETWEEN -200 AND 0);
Finished the log cleanup of table CAT.TPCDRI.CUSTOMER.


>>
>>log;
1,2c1,2
< >>  log TEMP1;
< >>  execute stat1;
---
> >>  log TEMP2;
> >>  execute stat2;
>>
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>
>>PREPARE stat1 FROM 
+>	select nation, yr, sum(amount) as sum_profit
+>	from (select
+>         	n_name as nation, 
+>         	extract(year from o_orderdate) as yr,
+>         	((l_extendedprice*(1-l_discount)) - (ps_supplycost*l_quantity)) as amount
+>     from part,supplier,lineitem,partsupp,orders, nation
+>     where 
+>         s_suppkey  = l_suppkey
+>         and ps_suppkey = l_suppkey
+>         and ps_partkey = l_partkey
+>         and p_partkey  = l_partkey
+>         and o_orderkey = l_orderkey
+>         and s_nationkey = n_nationkey
+>         and p_name like '%green%'
+>    ) as profit
+>	group by nation, yr
+>	order by nation, yr;

--- SQL command prepared.
>>
>>-- Basic Q9
>>
>>refresh mv4q9 debug 51;

--- SQL operation complete.
>>log;

 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
 Compiling Statement : 
The materialized view CAT.TPCDRI.MV4Q9 is being refreshed (by recompute) in a single transaction...

 Compiling Statement : 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q9 RECOMPUTE NODELETE 
 Compiling Statement : 
 Compiling Statement : 
The materialized view CAT.TPCDRI.MV4Q9 has been refreshed (by recompute) in a single transaction.

Starting the log cleanup of table CAT.TPCDRI.NATION...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.NATION)
WHERE
("@EPOCH" BETWEEN 101 AND 102)
OR
("@EPOCH" BETWEEN -102 AND 0);
Finished the log cleanup of table CAT.TPCDRI.NATION.

Starting the log cleanup of table CAT.TPCDRI.PARTSUPP...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.PARTSUPP)
WHERE
("@EPOCH" BETWEEN 101 AND 200)
OR
("@EPOCH" BETWEEN -200 AND 0);
Finished the log cleanup of table CAT.TPCDRI.PARTSUPP.

Starting the log cleanup of table CAT.TPCDRI.PART...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.PART)
WHERE
("@EPOCH" BETWEEN 101 AND 200)
OR
("@EPOCH" BETWEEN -200 AND 0);
Finished the log cleanup of table CAT.TPCDRI.PART.

Starting the log cleanup of table CAT.TPCDRI.ORDERS...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.ORDERS)
WHERE
("@EPOCH" BETWEEN 101 AND 200)
OR
("@EPOCH" BETWEEN -200 AND 0);
Finished the log cleanup of table CAT.TPCDRI.ORDERS.

Starting the log cleanup of table CAT.TPCDRI.LINEITEM...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.LINEITEM)
WHERE
("@EPOCH" BETWEEN 101 AND 200)
OR
("@EPOCH" BETWEEN -200 AND 0);
Finished the log cleanup of table CAT.TPCDRI.LINEITEM.

Starting the log cleanup of table CAT.TPCDRI.SUPPLIER...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.SUPPLIER)
WHERE
("@EPOCH" BETWEEN 101 AND 200)
OR
("@EPOCH" BETWEEN -200 AND 0);
Finished the log cleanup of table CAT.TPCDRI.SUPPLIER.

>>
>>PREPARE stat2 FROM 
+>	select nation, yr,sum_profit
+>	from mv4q9 
+>	order by nation, yr;

--- SQL command prepared.
>>
>>log;
1,2c1,2
< >>  log TEMP1;
< >>  execute stat1;
---
> >>  log TEMP2;
> >>  execute stat2;
>>
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>
>>
>>
>>	obey TESTMV215B(TEST2);
>>
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.supplier@ @0@ @300@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.customer@ @0@ @300@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.part@ @0@ @300@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.partsupp@ @0@ @300@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.lineitem@ @0@ @300@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.orders@ @0@ @300@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.region@ @0@ @300@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.nation@ @0@ @300@ ;

--- SQL operation complete.
>>
>>-------- BUG 508 -------------------------
>>------------------------------------------
>>-- unlocking log tables because of the bug
>>log;
>>-----------------------------------------
>>-----------------------------------------
>>
>>insert into tpcdRI.supplier
+>select *
+>from tpcd.supplier supplier
+>where s_suppkey >= 70 and
+>      s_suppkey < 80
+>order by s_suppkey;

--- 10 row(s) inserted.
>>
>>
>>insert into tpcdRI.part
+>select *
+>from tpcd.part 
+>where p_partkey >= 1300 and
+>      p_partkey < 1400
+>order by p_partkey;

--- 100 row(s) inserted.
>>
>>
>>--- to check 
>>select * from tpcdRI.customer
+>where c_custkey >= 630 and
+>      c_custkey < 650
+>order by c_custkey;

--- 0 row(s) selected.
>>
>>insert into tpcdRI.customer
+>select *
+>from tpcd.customer
+>where c_custkey >= 630 and
+>      c_custkey < 650
+>order by c_custkey;

--- 20 row(s) inserted.
>>
>>delete from tpcdRI.t1;

--- 803 row(s) deleted.
>>insert into tpcdRI.t1
+>  select c_custkey,0 from tpcdRI.customer;

--- 619 row(s) inserted.
>>
>>insert into tpcdRI.orders
+>select *
+>from tpcd.orders 
+>where o_orderkey >= 20000 and
+>      o_orderkey < 24000 
+>order by o_orderkey;

--- 482 row(s) inserted.
>>
>>
>>delete from tpcdRI.t1;

--- 619 row(s) deleted.
>>insert into tpcdRI.t1
+>  select ps_partkey,ps_suppkey from tpcdRI.partsupp;

--- 3585 row(s) inserted.
>>
>>insert into tpcdRI.partsupp
+>select *
+>from tpcd.partsupp
+>where ps_partkey in ( select p_partkey from tpcdRI.part) and
+>      ps_suppkey in ( select s_suppkey from tpcdRI.supplier) and
+>      ps_partkey,ps_suppkey not in (select * from tpcdRI.t1)
+>order by ps_partkey,ps_suppkey;

--- 835 row(s) inserted.
>>
>>
>>delete from tpcdRI.t1;

--- 3585 row(s) deleted.
>>insert into tpcdRI.t1
+>  select l_orderkey,l_linenumber from tpcdri.lineitem;

--- 2712 row(s) inserted.
>>
>>insert into tpcdRI.lineitemtemp
+>select *
+>from tpcd.lineitem
+>where l_partkey,l_suppkey in 
+>           ( select ps_partkey,ps_suppkey from tpcdRI.partsupp) and
+>	  l_orderkey in ( select o_orderkey from tpcdRI.orders) and
+>	  l_orderkey,l_linenumber not in (select * from tpcdRI.t1)
+>order by l_orderkey,l_linenumber;

--- 1415 row(s) inserted.
>>
>>insert into tpcdRI.lineitem select * from tpcdRI.lineitemtemp;

--- 1415 row(s) inserted.
>>
>>insert into region
+>values ( 700,'Moon','Space');

--- 1 row(s) inserted.
>>
>>insert into nation
+>values (2000,700,'Mars People','A small village');

--- 1 row(s) inserted.
>>-----------------------------------------------  End preparation -----------------------------------------------
>>-- Basic Q5
>>refresh mv4q5 debug 51;

--- SQL operation complete.
>>log;

 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 17 CAT.TPCDRI.REGION 1 3 1 0 24 REGION__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 17 CAT.TPCDRI.NATION 1 3 1 0 24 NATION__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 17 CAT.TPCDRI.ORDERS 1 3 1 0 24 ORDERS__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 19 CAT.TPCDRI.LINEITEM 1 3 1 0 26 LINEITEM__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 19 CAT.TPCDRI.SUPPLIER 1 3 1 0 26 SUPPLIER__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 19 CAT.TPCDRI.CUSTOMER 1 3 1 0 26 CUSTOMER__REFRESH__DDLLOCK ;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.REGION)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 300;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.NATION)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 300;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.ORDERS)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 300;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.LINEITEM)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 300;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.SUPPLIER)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 300;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.CUSTOMER)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 300;
The materialized view CAT.TPCDRI.MV4Q5 is being refreshed in a single transaction...

 Compiling Statement : 
 CONTROL TABLE *  MDAM 'ON';
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 103 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 102 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 0 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 103 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 102 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 1 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 103 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 102 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 2 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 103 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 102 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 3 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 103 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 102 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 4 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 103 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 102 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 5 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 103 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 102 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 6 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.LINEITEM BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.ORDERS BETWEEN 201 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 103 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 102 AND 300 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 7 
 Compiling Statement : 
 CONTROL TABLE *  RESET;
The materialized view CAT.TPCDRI.MV4Q5 has been refreshed (in 8 phases) in a single transaction.

Starting the log cleanup of table CAT.TPCDRI.REGION...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.REGION)
WHERE
("@EPOCH" BETWEEN 101 AND 300)
OR
("@EPOCH" BETWEEN -300 AND 0);
Finished the log cleanup of table CAT.TPCDRI.REGION.

Starting the log cleanup of table CAT.TPCDRI.NATION...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.NATION)
WHERE
("@EPOCH" BETWEEN 101 AND 103)
OR
("@EPOCH" BETWEEN -103 AND 0);
Finished the log cleanup of table CAT.TPCDRI.NATION.

Starting the log cleanup of table CAT.TPCDRI.ORDERS...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.ORDERS)
WHERE
("@EPOCH" BETWEEN 101 AND 201)
OR
("@EPOCH" BETWEEN -201 AND 0);
Finished the log cleanup of table CAT.TPCDRI.ORDERS.

Starting the log cleanup of table CAT.TPCDRI.LINEITEM...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.LINEITEM)
WHERE
("@EPOCH" BETWEEN 101 AND 201)
OR
("@EPOCH" BETWEEN -201 AND 0);
Finished the log cleanup of table CAT.TPCDRI.LINEITEM.

Starting the log cleanup of table CAT.TPCDRI.SUPPLIER...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.SUPPLIER)
WHERE
("@EPOCH" BETWEEN 101 AND 201)
OR
("@EPOCH" BETWEEN -201 AND 0);
Finished the log cleanup of table CAT.TPCDRI.SUPPLIER.

Starting the log cleanup of table CAT.TPCDRI.CUSTOMER...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.CUSTOMER)
WHERE
("@EPOCH" BETWEEN 101 AND 300)
OR
("@EPOCH" BETWEEN -300 AND 0);
Finished the log cleanup of table CAT.TPCDRI.CUSTOMER.


>>
>>-- MVJoinGraph:
>>-- Table no. 0: C.S.REGION,
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  0  0  0  1  0  .
>>--         Incoming RIs :  0  0  0  0  1  0  .
>>--         Outgoing RIs :  0  0  0  0  0  0  .
>>-- Table no. 1: C.S.NATION,
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  0  1  1  0  1  .
>>--         Incoming RIs :  0  0  1  1  0  0  .
>>--         Outgoing RIs :  0  0  0  0  0  1  .
>>-- Table no. 2: C.S.SUPPLIER,
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  1  0  1  0  1  0  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  1  0  .
>>-- Table no. 3: C.S.CUSTOMER,
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  1  0  1  1  0  .
>>--         Incoming RIs :  0  1  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  1  0  .
>>-- Table no. 4: C.S.ORDERS,
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  1  0  1  0  0  0  .
>>--         Incoming RIs :  1  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  1  0  0  0  .
>>-- Table no. 5: C.S.LINEITEM,
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  1  0  1  0  0  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  1  0  0  0  0  .
>>-- 
>>-- MVJoinGraphSolution (Score: 4): 2, 5, 4, 3, 1, 0, .
>>--   Product Matrix:
>>--    Sign   0  1  2  3  4  5
>>--     0 ) + d  T  T  T  T  T
>>--     1 ) - d  d  T  T  T  T
>>--     2 ) + T  d  T  T  T  T
>>-- 
>>
>>PREPARE stat1 FROM 
+>	select n_name, sum(l_extendedprice*(1-l_discount)) as revenue,count(*) rows_in_group
+>	from customer,orders,lineitem,supplier,nation, region
+>	where
+>	    c_custkey = o_custkey
+>	    and o_orderkey = l_orderkey
+>	    and l_suppkey = s_suppkey
+>	    and c_nationkey= s_nationkey
+>	    and s_nationkey = n_nationkey
+>	    and n_regionkey = r_regionkey
+>	    and r_name in ('ASIA','AMERICA','EUROPE','MIDDLE EAST','AFRICA')
+>	    and o_orderdate >= date '1994-01-01'
+>	    and o_orderdate < date '1994-01-01' + interval '3' year
+>	group by n_name
+>	order by n_name,revenue desc ;

--- SQL command prepared.
>>
>>PREPARE stat2 FROM 
+>	select n_name,revenue,rows_in_group
+>	from mv4q5 
+>	order by n_name,revenue desc;

--- SQL command prepared.
>>
>>log;
1,2c1,2
< >>  log TEMP1;
< >>  execute stat1;
---
> >>  log TEMP2;
> >>  execute stat2;
>>
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>
>>
>>
>>
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.supplier@ @0@ @310@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.customer@ @0@ @310@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.part@ @0@ @310@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.partsupp@ @0@ @310@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.lineitem@ @0@ @310@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.orders@ @0@ @310@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.region@ @0@ @310@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.nation@ @0@ @310@ ;

--- SQL operation complete.
>>
>>-------- BUG 508 -------------------------
>>------------------------------------------
>>-- unlocking log tables because of the bug
>>log;
>>-----------------------------------------
>>-----------------------------------------
>>
>>
>>insert into tpcdRI.supplier
+>select *
+>from tpcd.supplier supplier
+>where s_suppkey >= 85 and
+>      s_suppkey < 90
+>order by s_suppkey;

--- 5 row(s) inserted.
>>
>>
>>insert into tpcdRI.customer
+>select *
+>from tpcd.customer
+>where c_custkey >= 650 and
+>      c_custkey < 700
+>order by c_custkey;

--- 50 row(s) inserted.
>>
>>
>>delete from tpcdRI.t1;

--- 2712 row(s) deleted.
>>insert into tpcdRI.t1
+>  select l_orderkey,l_linenumber from tpcdri.lineitem;

--- 4127 row(s) inserted.
>>
>>insert into region
+>values ( 701,'Sun','Space');

--- 1 row(s) inserted.
>>
>>insert into nation
+>values (2001,701,'Dark People','A small village');

--- 1 row(s) inserted.
>>-----------------------------------------------  End preparation -----------------------------------------------
>>
>>refresh mv4q5 debug 51;

--- SQL operation complete.
>>log;

 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 17 CAT.TPCDRI.REGION 1 3 1 0 24 REGION__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 17 CAT.TPCDRI.NATION 1 3 1 0 24 NATION__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 17 CAT.TPCDRI.ORDERS 1 3 1 0 24 ORDERS__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 19 CAT.TPCDRI.LINEITEM 1 3 1 0 26 LINEITEM__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 19 CAT.TPCDRI.SUPPLIER 1 3 1 0 26 SUPPLIER__REFRESH__DDLLOCK ;
 Compiling Statement : 
 CREATE TANDEM_CAT_REQUEST&2 LIST 1 CREATE TANDEM_CAT_REQUEST&2 16 4 19 CAT.TPCDRI.CUSTOMER 1 3 1 0 26 CUSTOMER__REFRESH__DDLLOCK ;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.REGION)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 310;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.NATION)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 310;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.ORDERS)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 310;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.LINEITEM)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 310;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.SUPPLIER)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 310;
 Compiling Statement : 
 SELECT [FIRST 1] "@EPOCH"
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.CUSTOMER)
WHERE "@EPOCH" >= CAST (? AS INT)
AND "@EPOCH" <= 310;
The materialized view CAT.TPCDRI.MV4Q5 is being refreshed in a single transaction...

 Compiling Statement : 
 CONTROL TABLE *  MDAM 'ON';
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 301 AND 310 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 301 AND 310 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 301 AND 310 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 301 AND 310 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 0 
 Compiling Statement : 
 INTERNAL REFRESH CAT.TPCDRI.MV4Q5
 FROM MULTIDELTA 
	CAT.TPCDRI.CUSTOMER BETWEEN 301 AND 310 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.SUPPLIER BETWEEN 301 AND 310 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.NATION BETWEEN 301 AND 310 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG , 
	CAT.TPCDRI.REGION BETWEEN 301 AND 310 DE LEVEL 0
	 USE NO RANGELOG
	USE IUDLOG  
	PHASE 1 
 Compiling Statement : 
 CONTROL TABLE *  RESET;
The materialized view CAT.TPCDRI.MV4Q5 has been refreshed (in 2 phases) in a single transaction.

Starting the log cleanup of table CAT.TPCDRI.REGION...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.REGION)
WHERE
("@EPOCH" BETWEEN 101 AND 310)
OR
("@EPOCH" BETWEEN -310 AND 0);
Finished the log cleanup of table CAT.TPCDRI.REGION.

Starting the log cleanup of table CAT.TPCDRI.NATION...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.NATION)
WHERE
("@EPOCH" BETWEEN 101 AND 103)
OR
("@EPOCH" BETWEEN -103 AND 0);
Finished the log cleanup of table CAT.TPCDRI.NATION.

Starting the log cleanup of table CAT.TPCDRI.ORDERS...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.ORDERS)
WHERE
("@EPOCH" BETWEEN 101 AND 201)
OR
("@EPOCH" BETWEEN -201 AND 0);
Finished the log cleanup of table CAT.TPCDRI.ORDERS.

Starting the log cleanup of table CAT.TPCDRI.LINEITEM...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.LINEITEM)
WHERE
("@EPOCH" BETWEEN 101 AND 201)
OR
("@EPOCH" BETWEEN -201 AND 0);
Finished the log cleanup of table CAT.TPCDRI.LINEITEM.

Starting the log cleanup of table CAT.TPCDRI.SUPPLIER...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.SUPPLIER)
WHERE
("@EPOCH" BETWEEN 101 AND 201)
OR
("@EPOCH" BETWEEN -201 AND 0);
Finished the log cleanup of table CAT.TPCDRI.SUPPLIER.

Starting the log cleanup of table CAT.TPCDRI.CUSTOMER...

 Compiling Statement : 
 DELETE [FIRST 4000]
FROM TABLE(IUD_LOG_TABLE CAT.TPCDRI.CUSTOMER)
WHERE
("@EPOCH" BETWEEN 101 AND 310)
OR
("@EPOCH" BETWEEN -310 AND 0);
Finished the log cleanup of table CAT.TPCDRI.CUSTOMER.


>>
>>-- MVJoinGraph:
>>-- Table no. 0: C.S.REGION (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  0  0  0  1  0  .
>>--         Incoming RIs :  0  0  0  0  1  0  .
>>--         Outgoing RIs :  0  0  0  0  0  0  .
>>-- Table no. 1: C.S.NATION (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  0  1  1  0  1  .
>>--         Incoming RIs :  0  0  1  1  0  0  .
>>--         Outgoing RIs :  0  0  0  0  0  1  .
>>-- Table no. 2: C.S.SUPPLIER (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  1  0  1  0  1  0  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  1  0  .
>>-- Table no. 3: C.S.CUSTOMER (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  1  0  1  1  0  .
>>--         Incoming RIs :  0  1  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  1  0  .
>>-- Table no. 4: C.S.ORDERS (Empty Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  1  0  1  0  0  0  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  1  0  0  0  .
>>-- Table no. 5: C.S.LINEITEM (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  1  0  1  0  0  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  0  0  .
>>-- 
>>-- MVJoinGraphSolution (Score: 3): 2, 1, 0, 5, 4, 3, .
>>--   Product Matrix:
>>--    Sign   0  1  2  3  4  5
>>--     0 ) + d  T  T  T  T  T
>>--     1 ) - d  T  T  d  T  T
>>--     2 ) + T  T  T  d  T  T
>>-- 
>>
>>PREPARE stat1 FROM 
+>	select n_name, sum(l_extendedprice*(1-l_discount)) as revenue,count(*) rows_in_group
+>	from customer,orders,lineitem,supplier,nation, region
+>	where
+>	    c_custkey = o_custkey
+>	    and o_orderkey = l_orderkey
+>	    and l_suppkey = s_suppkey
+>	    and c_nationkey= s_nationkey
+>	    and s_nationkey = n_nationkey
+>	    and n_regionkey = r_regionkey
+>	    and r_name in ('ASIA','AMERICA','EUROPE','MIDDLE EAST','AFRICA')
+>	    and o_orderdate >= date '1994-01-01'
+>	    and o_orderdate < date '1994-01-01' + interval '3' year
+>	group by n_name
+>	order by n_name,revenue desc ;

--- SQL command prepared.
>>
>>PREPARE stat2 FROM 
+>	select n_name,revenue,rows_in_group
+>	from mv4q5 
+>	order by n_name,revenue desc;

--- SQL command prepared.
>>
>>log;
1,2c1,2
< >>  log TEMP1;
< >>  execute stat1;
---
> >>  log TEMP2;
> >>  execute stat2;
>>
>>
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>
>>
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.supplier@ @0@ @320@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.customer@ @0@ @320@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.part@ @0@ @320@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.partsupp@ @0@ @320@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.lineitem@ @0@ @320@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.orders@ @0@ @320@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.region@ @0@ @320@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.nation@ @0@ @320@ ;

--- SQL operation complete.
>>
>>-------- BUG 508 -------------------------
>>------------------------------------------
>>-- unlocking log tables because of the bug
>>log;
>>-----------------------------------------
>>-----------------------------------------
>>
>>insert into tpcdRI.supplier
+>select *
+>from tpcd.supplier supplier
+>where s_suppkey >= 90 and
+>      s_suppkey < 95
+>order by s_suppkey;

--- 5 row(s) inserted.
>>
>>
>>insert into tpcdRI.part
+>select *
+>from tpcd.part 
+>where p_partkey >= 1400 and
+>      p_partkey < 1600
+>order by p_partkey;

--- 200 row(s) inserted.
>>
>>insert into tpcdRI.customer
+>select *
+>from tpcd.customer
+>where c_custkey >= 700 and
+>      c_custkey < 900
+>order by c_custkey;

--- 200 row(s) inserted.
>>
>>delete from tpcdRI.t1;

--- 4127 row(s) deleted.
>>insert into tpcdRI.t1
+>  select c_custkey,0 from tpcdRI.customer;

--- 869 row(s) inserted.
>>
>>insert into tpcdRI.orders
+>select *
+>from tpcd.orders 
+>where o_orderkey >= 24000 and
+>      o_orderkey < 26000 
+>order by o_orderkey;

--- 221 row(s) inserted.
>>
>>
>>delete from tpcdRI.t1;

--- 869 row(s) deleted.
>>insert into tpcdRI.t1
+>  select ps_partkey,ps_suppkey from tpcdRI.partsupp;

--- 4420 row(s) inserted.
>>
>>insert into tpcdRI.partsupp
+>select *
+>from tpcd.partsupp
+>where ps_partkey in ( select p_partkey from tpcdRI.part) and
+>      ps_suppkey in ( select s_suppkey from tpcdRI.supplier) and
+>      ps_partkey,ps_suppkey not in (select * from tpcdRI.t1)
+>order by ps_partkey,ps_suppkey;

--- 356 row(s) inserted.
>>
>>
>>delete from tpcdRI.t1;

--- 4420 row(s) deleted.
>>insert into tpcdRI.t1
+>  select l_orderkey,l_linenumber from tpcdri.lineitem;

--- 4127 row(s) inserted.
>>
>>delete from tpcdRI.lineitemtemp;

--- 1415 row(s) deleted.
>>insert into tpcdRI.lineitemtemp
+>select *
+>from tpcd.lineitem
+>where l_partkey,l_suppkey in 
+>           ( select ps_partkey,ps_suppkey from tpcdRI.partsupp) and
+>	  l_orderkey in ( select o_orderkey from tpcdRI.orders) and
+>	  l_orderkey,l_linenumber not in (select * from tpcdRI.t1)
+>order by l_orderkey,l_linenumber;

--- 687 row(s) inserted.
>>
>>insert into tpcdRI.lineitem select * from tpcdRI.lineitemtemp;

--- 687 row(s) inserted.
>>
>>
>>insert into region
+>values ( 702,'Saturn','Space');

--- 1 row(s) inserted.
>>
>>update nation
+>set n_name = ' Updated '
+>where n_nationkey < 2;

--- 2 row(s) updated.
>>-----------------------------------------------  End preparation -----------------------------------------------
>>
>>refresh mv4q5;

--- SQL operation complete.
>>log;

The materialized view CAT.TPCDRI.MV4Q5 is being refreshed in a single transaction...

The materialized view CAT.TPCDRI.MV4Q5 has been refreshed (in 8 phases) in a single transaction.

Starting the log cleanup of table CAT.TPCDRI.REGION...

Finished the log cleanup of table CAT.TPCDRI.REGION.

Starting the log cleanup of table CAT.TPCDRI.NATION...

Finished the log cleanup of table CAT.TPCDRI.NATION.

Starting the log cleanup of table CAT.TPCDRI.ORDERS...

Finished the log cleanup of table CAT.TPCDRI.ORDERS.

Starting the log cleanup of table CAT.TPCDRI.LINEITEM...

Finished the log cleanup of table CAT.TPCDRI.LINEITEM.

Starting the log cleanup of table CAT.TPCDRI.SUPPLIER...

Finished the log cleanup of table CAT.TPCDRI.SUPPLIER.

Starting the log cleanup of table CAT.TPCDRI.CUSTOMER...

Finished the log cleanup of table CAT.TPCDRI.CUSTOMER.


>>
>>-- MVJoinGraph:
>>-- Table no. 0: C.S.REGION (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  0  0  0  1  0  .
>>--         Incoming RIs :  0  0  0  0  1  0  .
>>--         Outgoing RIs :  0  0  0  0  0  0  .
>>-- Table no. 1: C.S.NATION (Nonempty Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  0  1  1  0  1  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  0  1  .
>>-- Table no. 2: C.S.SUPPLIER (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  1  0  1  0  1  0  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  0  0  .
>>-- Table no. 3: C.S.CUSTOMER (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  1  0  1  1  0  .
>>--         Incoming RIs :  0  1  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  0  0  .
>>-- Table no. 4: C.S.ORDERS (Empty Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  1  0  1  0  0  0  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  1  0  0  0  .
>>-- Table no. 5: C.S.LINEITEM (ReadOnly Delta),
>>--         TableIndices :  5, 4, 3, 2, 1, 0, .
>>--         Predicates to:  0  1  0  1  0  0  .
>>--         Incoming RIs :  0  0  0  0  0  0  .
>>--         Outgoing RIs :  0  0  0  0  0  0  .
>>-- 
>>-- MVJoinGraphSolution (Score: 2): 1, 0, 2, 5, 4, 3, .
>>--   Product Matrix:
>>--    Sign   0  1  2  3  4  5
>>--     0 ) + d  T  T  T  T  T
>>--     1 ) - d  T  d  T  T  T
>>--     2 ) + T  T  d  T  T  T
>>--     3 ) - d  T  T  d  T  T
>>--     4 ) + d  T  d  d  T  T
>>--     5 ) - T  T  d  d  T  T
>>--     6 ) + T  T  T  d  T  T
>>-- 
>>
>>PREPARE stat1 FROM 
+>	select n_name, sum(l_extendedprice*(1-l_discount)) as revenue,count(*) rows_in_group
+>	from customer,orders,lineitem,supplier,nation, region
+>	where
+>	    c_custkey = o_custkey
+>	    and o_orderkey = l_orderkey
+>	    and l_suppkey = s_suppkey
+>	    and c_nationkey= s_nationkey
+>	    and s_nationkey = n_nationkey
+>	    and n_regionkey = r_regionkey
+>	    and r_name in ('ASIA','AMERICA','EUROPE','MIDDLE EAST','AFRICA')
+>	    and o_orderdate >= date '1994-01-01'
+>	    and o_orderdate < date '1994-01-01' + interval '3' year
+>	group by n_name
+>	order by n_name,revenue desc ;

--- SQL command prepared.
>>
>>PREPARE stat2 FROM 
+>	select n_name,revenue,rows_in_group
+>	from mv4q5 
+>	order by n_name,revenue desc;

--- SQL command prepared.
>>
>>log;
1,2c1,2
< >>  log TEMP1;
< >>  execute stat1;
---
> >>  log TEMP2;
> >>  execute stat2;
>>
>>
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.supplier@ @0@ @330@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.customer@ @0@ @330@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.part@ @0@ @330@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.partsupp@ @0@ @330@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.lineitem@ @0@ @330@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.orders@ @0@ @330@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.region@ @0@ @330@ ;

--- SQL operation complete.
>>CREATE TANDEM_CAT_REQUEST&1 16 3 @cat.tpcdRI.nation@ @0@ @330@ ;

--- SQL operation complete.
>>
>>-------- BUG 508 -------------------------
>>------------------------------------------
>>-- unlocking log tables because of the bug
>>log;
>>-----------------------------------------
>>-----------------------------------------
>>
>>
>>insert into tpcdRI.supplier
+>select *
+>from tpcd.supplier supplier
+>where s_suppkey >= 95 and
+>      s_suppkey < 100
+>order by s_suppkey;

--- 5 row(s) inserted.
>>
>>insert into tpcdRI.customer
+>select *
+>from tpcd.customer
+>where c_custkey >= 900 and
+>      c_custkey < 950
+>order by c_custkey;

--- 50 row(s) inserted.
>>
>>delete from tpcdRI.t1;

--- 4127 row(s) deleted.
>>insert into tpcdRI.t1
+>  select c_custkey,0 from tpcdRI.customer;

--- 919 row(s) inserted.
>>
>>insert into tpcdRI.orders
+>select *
+>from tpcd.orders 
+>where o_orderkey >= 26000 and
+>      o_orderkey < 28000 
+>order by o_orderkey;

--- 212 row(s) inserted.
>>
>>
>>delete from tpcdRI.t1;

--- 919 row(s) deleted.
>>insert into tpcdRI.t1
+>  select l_orderkey,l_linenumber from tpcdri.lineitem;

--- 4814 row(s) inserted.
>>
>>delete from tpcdRI.lineitemtemp;

--- 687 row(s) deleted.
>>insert into tpcdRI.lineitemtemp
+>select *
+>from tpcd.lineitem
+>where l_partkey,l_suppkey in 
+>           ( select ps_partkey,ps_suppkey from tpcdRI.partsupp) and
+>	  l_orderkey in ( select o_orderkey from tpcdRI.orders) and
+>	  l_orderkey,l_linenumber not in (select * from tpcdRI.t1)
+>order by l_orderkey,l_linenumber;

--- 304 row(s) inserted.
>>
>>insert into tpcdRI.lineitem select * from tpcdRI.lineitemtemp;

--- 304 row(s) inserted.
>>
>>
>>
>>insert into region
+>values ( 703,'Volcan','Space');

--- 1 row(s) inserted.
>>
>>update nation
+>set n_comment = 'UPD10'
+>where n_nationkey = 10;

--- 1 row(s) updated.
>>
>>delete from customertemp;

--- 0 row(s) deleted.
>>insert into customertemp select * from customer;

--- 919 row(s) inserted.
>>
>>update tpcdRI.customer
+>set c_nationkey = 12 -- 'JAPAN'
+>where c_custkey in (
+>	select c_custkey
+>	from customertemp,nation
+>	where c_nationkey = n_nationkey 
+>	      and c_acctbal < 4000
+>	      and n_name = 'IRAN'
+>	);

--- 24 row(s) updated.
>>
>>delete from customertemp;

--- 919 row(s) deleted.
>>insert into customertemp select * from customer;

--- 919 row(s) inserted.
>>
>>update tpcdRI.customer
+>set c_nationkey = 10 -- 'IRAN'
+>where c_custkey in (
+>	select c_custkey
+>	from customertemp,nation
+>	where c_nationkey = n_nationkey 
+>	      and c_acctbal > 3000
+>	      and n_name = 'JAPAN'
+>	);

--- 33 row(s) updated.
>>
>>delete from customertemp;

--- 919 row(s) deleted.
>>insert into customertemp select * from customer;

--- 919 row(s) inserted.
>>
>>update tpcdRI.customer
+>set c_nationkey = 12 -- 'IRAN'
+>where c_custkey in (
+>	select c_custkey
+>	from customertemp,nation
+>	where c_nationkey = n_nationkey 
+>	      and c_acctbal < 2500
+>	      and n_name = 'JAPAN'
+>	);

--- 26 row(s) updated.
>>
>>-----------------------------------------------  End preparation -----------------------------------------------
>>
>>-- Q5, all deltas are non-empty (no RIs can be used).
>>refresh mv4q5;

--- SQL operation complete.
>>log;

The materialized view CAT.TPCDRI.MV4Q5 is being refreshed in a single transaction...

The materialized view CAT.TPCDRI.MV4Q5 has been refreshed (in 8 phases) in a single transaction.

Starting the log cleanup of table CAT.TPCDRI.REGION...

Finished the log cleanup of table CAT.TPCDRI.REGION.

Starting the log cleanup of table CAT.TPCDRI.NATION...

Finished the log cleanup of table CAT.TPCDRI.NATION.

Starting the log cleanup of table CAT.TPCDRI.ORDERS...

Finished the log cleanup of table CAT.TPCDRI.ORDERS.

Starting the log cleanup of table CAT.TPCDRI.LINEITEM...

Finished the log cleanup of table CAT.TPCDRI.LINEITEM.

Starting the log cleanup of table CAT.TPCDRI.SUPPLIER...

Finished the log cleanup of table CAT.TPCDRI.SUPPLIER.

Starting the log cleanup of table CAT.TPCDRI.CUSTOMER...

Finished the log cleanup of table CAT.TPCDRI.CUSTOMER.


>>
>>--internal refresh mv4q5 from multidelta
>>--        customer between 10 and 10 no de,
>>--        orders	 between 10 and 10 no de,
>>--        lineitem between 10 and 10 no de,
>>--        supplier between 10 and 10 no de,
>>--        nation	 between 10 and 10 no de,
>>--        region	 between 10 and 10 no de
>>--        phase 1;
>>
>>--internal refresh mv4q5 from multidelta
>>--        customer between 10 and 10 no de,
>>--        orders	 between 10 and 10 no de,
>>--        lineitem between 10 and 10 no de,
>>--        supplier between 10 and 10 no de,
>>--       nation	 between 10 and 10 no de,
>>--        region	 between 10 and 10 no de
>>--        phase 2;
>>
>>--internal refresh mv4q5 from multidelta
>>--        customer between 10 and 10 no de,
>>--        orders	 between 10 and 10 no de,
>>--        lineitem between 10 and 10 no de,
>>--        supplier between 10 and 10 no de,
>>--        nation	 between 10 and 10 no de,
>>--        region	 between 10 and 10 no de
>>--        phase 3;
>>
>>
>>PREPARE stat1 FROM 
+>	select n_name, sum(l_extendedprice*(1-l_discount)) as revenue,count(*) rows_in_group
+>	from customer,orders,lineitem,supplier,nation, region
+>	where
+>	    c_custkey = o_custkey
+>	    and o_orderkey = l_orderkey
+>	    and l_suppkey = s_suppkey
+>	    and c_nationkey= s_nationkey
+>	    and s_nationkey = n_nationkey
+>	    and n_regionkey = r_regionkey
+>	    and r_name in ('ASIA','AMERICA','EUROPE','MIDDLE EAST','AFRICA')
+>	    and o_orderdate >= date '1994-01-01'
+>	    and o_orderdate < date '1994-01-01' + interval '3' year
+>	group by n_name
+>	order by n_name,revenue desc ;

--- SQL command prepared.
>>
>>PREPARE stat2 FROM 
+>	select n_name,revenue,rows_in_group
+>	from mv4q5 
+>	order by n_name,revenue desc;

--- SQL command prepared.
>>
>>log;
1,2c1,2
< >>  log TEMP1;
< >>  execute stat1;
---
> >>  log TEMP2;
> >>  execute stat2;
>>
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- ---------------------------------------------------------------------------
>>-- Clean and exit
>>log;
