diff -u orig/v2.8.0rc4/query_templates/netezza.tpl v2.8.0rc4/query_templates/netezza.tpl
--- orig/v2.8.0rc4/query_templates/netezza.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/netezza.tpl	2018-11-23 00:24:04.604986769 +0300
@@ -35,3 +35,8 @@
 define __LIMITA = "";
 define __LIMITB = "";
 define __LIMITC = "limit %d";
+define _END = "select concat('LOG_','END:') as header,  @query_name, timestampdiff(microsecond, @query_start, current_timestamp(6))/1000 as microsecs;";
+
+select '[_TEMPLATE]' into @query_name;
+select current_timestamp(6) into @query_start;
+select concat('LOG_','START') as header, @query_name;
diff -u orig/v2.8.0rc4/query_templates/query12.tpl v2.8.0rc4/query_templates/query12.tpl
--- orig/v2.8.0rc4/query_templates/query12.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query12.tpl	2018-11-22 15:10:24.620915299 +0300
@@ -55,7 +55,7 @@
   	and i_category in ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]')
   	and ws_sold_date_sk = d_date_sk
 	and d_date between cast('[SDATE]' as date) 
-				and (cast('[SDATE]' as date) + 30 days)
+				and date_add(cast('[SDATE]' as date), interval 30 day)
 group by 
 	i_item_id
         ,i_item_desc 
diff -u orig/v2.8.0rc4/query_templates/query20.tpl v2.8.0rc4/query_templates/query20.tpl
--- orig/v2.8.0rc4/query_templates/query20.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query20.tpl	2018-11-22 15:11:05.640438684 +0300
@@ -52,7 +52,7 @@
    and i_category in ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]')
    and cs_sold_date_sk = d_date_sk
  and d_date between cast('[SDATE]' as date) 
- 				and (cast('[SDATE]' as date) + 30 days)
+ 				and date_add(cast('[SDATE]' as date), interval 30 day)
  group by i_item_id
          ,i_item_desc 
          ,i_category
diff -u orig/v2.8.0rc4/query_templates/query21.tpl v2.8.0rc4/query_templates/query21.tpl
--- orig/v2.8.0rc4/query_templates/query21.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query21.tpl	2018-11-22 15:19:51.044038572 +0300
@@ -39,10 +39,10 @@
  [_LIMITA] select [_LIMITB] *
  from(select w_warehouse_name
             ,i_item_id
-            ,sum(case when (cast(d_date as date) < cast ('[SALES_DATE]' as date))
+            ,sum(case when (cast(d_date as date) < cast('[SALES_DATE]' as date))
 	                then inv_quantity_on_hand 
                       else 0 end) as inv_before
-            ,sum(case when (cast(d_date as date) >= cast ('[SALES_DATE]' as date))
+            ,sum(case when (cast(d_date as date) >= cast('[SALES_DATE]' as date))
                       then inv_quantity_on_hand 
                       else 0 end) as inv_after
    from inventory
@@ -53,8 +53,8 @@
      and i_item_sk          = inv_item_sk
      and inv_warehouse_sk   = w_warehouse_sk
      and inv_date_sk    = d_date_sk
-     and d_date between (cast ('[SALES_DATE]' as date) - 30 days)
-                    and (cast ('[SALES_DATE]' as date) + 30 days)
+     and d_date between date_sub(cast('[SALES_DATE]' as date), interval 30 day)
+                    and date_add(cast('[SALES_DATE]' as date), interval 30 day)
    group by w_warehouse_name, i_item_id) x
  where (case when inv_before > 0 
              then inv_after / inv_before 
diff -u orig/v2.8.0rc4/query_templates/query32.tpl v2.8.0rc4/query_templates/query32.tpl
--- orig/v2.8.0rc4/query_templates/query32.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query32.tpl	2018-11-22 15:14:58.143178415 +0300
@@ -46,7 +46,7 @@
 i_manufact_id = [IMID]
 and i_item_sk = cs_item_sk 
 and d_date between '[CSDATE]' and 
-        (cast('[CSDATE]' as date) + 90 days)
+        date_add(cast('[CSDATE]' as date), interval 90 day)
 and d_date_sk = cs_sold_date_sk 
 and cs_ext_discount_amt  
      > ( 
@@ -58,7 +58,7 @@
          where 
               cs_item_sk = i_item_sk 
           and d_date between '[CSDATE]' and
-                             (cast('[CSDATE]' as date) + 90 days)
+                             date_add(cast('[CSDATE]' as date), interval 90 day)
           and d_date_sk = cs_sold_date_sk 
       ) 
 [_LIMITC]; 
diff -u orig/v2.8.0rc4/query_templates/query37.tpl v2.8.0rc4/query_templates/query37.tpl
--- orig/v2.8.0rc4/query_templates/query37.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query37.tpl	2018-11-22 15:16:47.719248329 +0300
@@ -45,7 +45,7 @@
  where i_current_price between [PRICE] and [PRICE] + 30
  and inv_item_sk = i_item_sk
  and d_date_sk=inv_date_sk
- and d_date between cast('[INVDATE]' as date) and (cast('[INVDATE]' as date) +  60 days)
+ and d_date between cast('[INVDATE]' as date) and date_add(cast('[INVDATE]' as date), interval 60 day)
  and i_manufact_id in ([MANUFACT_ID.1],[MANUFACT_ID.2],[MANUFACT_ID.3],[MANUFACT_ID.4])
  and inv_quantity_on_hand between 100 and 500
  and cs_item_sk = i_item_sk
diff -u orig/v2.8.0rc4/query_templates/query40.tpl v2.8.0rc4/query_templates/query40.tpl
--- orig/v2.8.0rc4/query_templates/query40.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query40.tpl	2018-11-22 15:19:51.048038596 +0300
@@ -39,9 +39,9 @@
  [_LIMITA] select [_LIMITB] 
    w_state
   ,i_item_id
-  ,sum(case when (cast(d_date as date) < cast ('[SALES_DATE]' as date)) 
+  ,sum(case when (cast(d_date as date) < cast('[SALES_DATE]' as date)) 
  		then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_before
-  ,sum(case when (cast(d_date as date) >= cast ('[SALES_DATE]' as date)) 
+  ,sum(case when (cast(d_date as date) >= cast('[SALES_DATE]' as date)) 
  		then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_after
  from
    catalog_sales left outer join catalog_returns on
@@ -55,8 +55,8 @@
  and i_item_sk          = cs_item_sk
  and cs_warehouse_sk    = w_warehouse_sk 
  and cs_sold_date_sk    = d_date_sk
- and d_date between (cast ('[SALES_DATE]' as date) - 30 days)
-                and (cast ('[SALES_DATE]' as date) + 30 days) 
+ and d_date between (cast('[SALES_DATE]' as date) - 30 days)
+                and (cast('[SALES_DATE]' as date) + 30 days) 
  group by
     w_state,i_item_id
  order by w_state,i_item_id
diff -u orig/v2.8.0rc4/query_templates/query5.tpl v2.8.0rc4/query_templates/query5.tpl
--- orig/v2.8.0rc4/query_templates/query5.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query5.tpl	2018-11-22 15:19:10.855804400 +0300
@@ -63,7 +63,7 @@
      store
  where date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date) 
-                  and (cast('[SALES_DATE]' as date) +  14 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 14 day)
        and store_sk = s_store_sk
  group by s_store_id)
  ,
@@ -94,7 +94,7 @@
      catalog_page
  where date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  14 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 14 day)
        and page_sk = cp_catalog_page_sk
  group by cp_catalog_page_id)
  ,
@@ -127,7 +127,7 @@
      web_site
  where date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  14 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 14 days)
        and wsr_web_site_sk = web_site_sk
  group by web_site_id)
  [_LIMITA] select [_LIMITB] channel
diff -u orig/v2.8.0rc4/query_templates/query77.tpl v2.8.0rc4/query_templates/query77.tpl
--- orig/v2.8.0rc4/query_templates/query77.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query77.tpl	2018-11-22 15:21:54.000928955 +0300
@@ -45,7 +45,7 @@
       store
  where ss_sold_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date) 
-                  and (cast('[SALES_DATE]' as date) +  30 days) 
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day) 
        and ss_store_sk = s_store_sk
  group by s_store_sk)
  ,
@@ -58,7 +58,7 @@
       store
  where sr_returned_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  30 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day)
        and sr_store_sk = s_store_sk
  group by s_store_sk), 
  cs as
@@ -69,7 +69,7 @@
       date_dim
  where cs_sold_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  30 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day)
  group by cs_call_center_sk 
  ), 
  cr as
@@ -80,7 +80,7 @@
       date_dim
  where cr_returned_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  30 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day)
  group by cr_call_center_sk
  ), 
  ws as
@@ -92,7 +92,7 @@
       web_page
  where ws_sold_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  30 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day)
        and ws_web_page_sk = wp_web_page_sk
  group by wp_web_page_sk), 
  wr as
@@ -104,7 +104,7 @@
       web_page
  where wr_returned_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  30 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day)
        and wr_web_page_sk = wp_web_page_sk
  group by wp_web_page_sk)
  [_LIMITA] select [_LIMITB] channel
diff -u orig/v2.8.0rc4/query_templates/query80.tpl v2.8.0rc4/query_templates/query80.tpl
--- orig/v2.8.0rc4/query_templates/query80.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query80.tpl	2018-11-22 15:22:51.645424586 +0300
@@ -49,7 +49,7 @@
      promotion
  where ss_sold_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date) 
-                  and (cast('[SALES_DATE]' as date) +  30 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day)
        and ss_store_sk = s_store_sk
        and ss_item_sk = i_item_sk
        and i_current_price > 50
@@ -70,7 +70,7 @@
      promotion
  where cs_sold_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  30 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day)
         and cs_catalog_page_sk = cp_catalog_page_sk
        and cs_item_sk = i_item_sk
        and i_current_price > 50
@@ -91,7 +91,7 @@
      promotion
  where ws_sold_date_sk = d_date_sk
        and d_date between cast('[SALES_DATE]' as date)
-                  and (cast('[SALES_DATE]' as date) +  30 days)
+                  and date_add(cast('[SALES_DATE]' as date), interval 30 day)
         and ws_web_site_sk = web_site_sk
        and ws_item_sk = i_item_sk
        and i_current_price > 50
diff -u orig/v2.8.0rc4/query_templates/query82.tpl v2.8.0rc4/query_templates/query82.tpl
--- orig/v2.8.0rc4/query_templates/query82.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query82.tpl	2018-11-22 15:24:02.250089313 +0300
@@ -45,7 +45,7 @@
  where i_current_price between [PRICE] and [PRICE]+30
  and inv_item_sk = i_item_sk
  and d_date_sk=inv_date_sk
- and d_date between cast('[INVDATE]' as date) and (cast('[INVDATE]' as date) +  60 days)
+ and d_date between cast('[INVDATE]' as date) and date_add(cast('[INVDATE]' as date), interval 60 day)
  and i_manufact_id in ([MANUFACT_ID.1],[MANUFACT_ID.2],[MANUFACT_ID.3],[MANUFACT_ID.4])
  and inv_quantity_on_hand between 100 and 500
  and ss_item_sk = i_item_sk
diff -u orig/v2.8.0rc4/query_templates/query92.tpl v2.8.0rc4/query_templates/query92.tpl
--- orig/v2.8.0rc4/query_templates/query92.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query92.tpl	2018-11-22 15:24:02.262089431 +0300
@@ -48,7 +48,7 @@
 i_manufact_id = [IMID]
 and i_item_sk = ws_item_sk 
 and d_date between '[WSDATE]' and 
-        (cast('[WSDATE]' as date) + 90 days)
+        date_add(cast('[WSDATE]' as date), interval 90 day)
 and d_date_sk = ws_sold_date_sk 
 and ws_ext_discount_amt  
      > ( 
@@ -60,7 +60,7 @@
          WHERE 
               ws_item_sk = i_item_sk 
           and d_date between '[WSDATE]' and
-                             (cast('[WSDATE]' as date) + 90 days)
+                             date_add(cast('[WSDATE]' as date), interval 90 day)
           and d_date_sk = ws_sold_date_sk 
       ) 
 order by sum(ws_ext_discount_amt)
diff -u orig/v2.8.0rc4/query_templates/query94.tpl v2.8.0rc4/query_templates/query94.tpl
--- orig/v2.8.0rc4/query_templates/query94.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query94.tpl	2018-11-22 15:24:21.258278119 +0300
@@ -49,7 +49,7 @@
   ,web_site
 where
     d_date between '[YEAR]-[MONTH]-01' and 
-           (cast('[YEAR]-[MONTH]-01' as date) + 60 days)
+           date_add(cast('[YEAR]-[MONTH]-01' as date), interval 60 day)
 and ws1.ws_ship_date_sk = d_date_sk
 and ws1.ws_ship_addr_sk = ca_address_sk
 and ca_state = '[STATE]'
diff -u orig/v2.8.0rc4/query_templates/query95.tpl v2.8.0rc4/query_templates/query95.tpl
--- orig/v2.8.0rc4/query_templates/query95.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query95.tpl	2018-11-22 15:24:33.086397578 +0300
@@ -54,7 +54,7 @@
   ,web_site
 where
     d_date between '[YEAR]-[MONTH]-01' and 
-           (cast('[YEAR]-[MONTH]-01' as date) + 60 days)
+           date_add(cast('[YEAR]-[MONTH]-01' as date), interval 60 day)
 and ws1.ws_ship_date_sk = d_date_sk
 and ws1.ws_ship_addr_sk = ca_address_sk
 and ca_state = '[STATE]'
diff -u orig/v2.8.0rc4/query_templates/query98.tpl v2.8.0rc4/query_templates/query98.tpl
--- orig/v2.8.0rc4/query_templates/query98.tpl	2018-02-15 07:41:02.000000000 +0300
+++ v2.8.0rc4/query_templates/query98.tpl	2018-11-22 15:24:50.554576684 +0300
@@ -54,7 +54,7 @@
   	and i_category in ('[CATEGORY.1]', '[CATEGORY.2]', '[CATEGORY.3]')
   	and ss_sold_date_sk = d_date_sk
 	and d_date between cast('[SDATE]' as date) 
-				and (cast('[SDATE]' as date) + 30 days)
+				and date_add(cast('[SDATE]' as date) , interval 30 day)
 group by 
 	i_item_id
         ,i_item_desc 
