Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Index traversal forbidding the use of Partitions - response (4) by mjasrotia

$
0
0
  I am on TD 13   Given below are the Explains without and with the PROD_ID Filters. Can you please help me understand why Teradata is creating a Bit map even in the cases where I am using just one filter in my query( Not this one but in another query). BMSMS is taking a lot of time.   EXPLAIN without the PROD_ID Filter   1) First, we lock MIM_TBL.RETAIL_SHIPMENT_T in view      mim.RETAIL_SHIPMENT for access, we lock MIM_TBL.RETAIL_T in view      mim.RETAIL for access, we lock MIM_TBL.RETAIL_EXTN_T in view      mim.Retail_Extn for access, and we lock MIM_TBL.PRODUCT_T in view      mim.Product for access.    2) Next, we do an all-AMPs RETRIEVE step from MIM_TBL.PRODUCT_T in      view mim.Product by way of an all-rows scan with a condition of (      "(MIM_TBL.PRODUCT_T in view mim.Product.Brand_Family_Id = 1489)      AND ((MIM_TBL.PRODUCT_T in view mim.Product.Company_Id = 59) AND      (MIM_TBL.PRODUCT_T in view mim.Product.Catg_Id = 3 ))") into Spool      8 (all_amps) (compressed columns allowed), which is duplicated on      all AMPs.  The size of Spool 8 is estimated with high confidence      to be 3,960 rows (67,320 bytes).  The estimated time for this step      is 0.02 seconds.    3) We do an all-AMPs JOIN step from Spool 8 (Last Use) by way of an      all-rows scan, which is joined to 2 partitions of      MIM_TBL.RETAIL_SHIPMENT_T in view mim.RETAIL_SHIPMENT with a      condition of ("(MIM_TBL.RETAIL_SHIPMENT_T in view      mim.RETAIL_SHIPMENT.Shipment_Dt = DATE '2013-02-16') OR      (MIM_TBL.RETAIL_SHIPMENT_T in view mim.RETAIL_SHIPMENT.Shipment_Dt      = DATE '2012-02-18')").  Spool 8 and MIM_TBL.RETAIL_SHIPMENT_T are      joined using a single partition hash_ join, with a join condition      of ("MIM_TBL.RETAIL_SHIPMENT_T.Prod_Id = Prod_Id").  The input      table MIM_TBL.RETAIL_SHIPMENT_T will not be cached in memory.  The      result goes into Spool 9 (all_amps) (compressed columns allowed),      which is built locally on the AMPs.  Then we do a SORT to order      Spool 9 by the hash code of (MIM_TBL.RETAIL_SHIPMENT_T.Rtl_Id).       The size of Spool 9 is estimated with low confidence to be 499,367      rows (8,489,239 bytes).  The estimated time for this step is 3.36      seconds.    4) We do an all-AMPs JOIN step from MIM_TBL.RETAIL_T in view      mim.RETAIL by way of a RowHash match scan with no residual      conditions, which is joined to Spool 9 (Last Use) by way of a      RowHash match scan.  MIM_TBL.RETAIL_T and Spool 9 are joined using      a merge join, with a join condition of ("Rtl_Id =      MIM_TBL.RETAIL_T.Rtl_Id").  The result goes into Spool 10      (all_amps) (compressed columns allowed), which is built locally on      the AMPs.  The size of Spool 10 is estimated with low confidence      to be 499,367 rows (29,962,020 bytes).  The estimated time for      this step is 0.18 seconds.    5) We do an all-AMPs JOIN step from MIM_TBL.RETAIL_EXTN_T in view      mim.Retail_Extn by way of a RowHash match scan with no residual      conditions, which is joined to Spool 10 (Last Use) by way of a      RowHash match scan.  MIM_TBL.RETAIL_EXTN_T and Spool 10 are joined      using a merge join, with a join condition of ("(Rtl_Id =      MIM_TBL.RETAIL_EXTN_T.Rtl_Id) AND (MIM_TBL.RETAIL_EXTN_T.Rtl_Id =      Rtl_Id)").  The result goes into Spool 7 (all_amps) (compressed      columns allowed), which is built locally on the AMPs.  The size of      Spool 7 is estimated with low confidence to be 499,367 rows (      33,956,956 bytes).  The estimated time for this step is 0.56      seconds.    6) We do an all-AMPs SUM step to aggregate from Spool 7 (Last Use) by      way of an all-rows scan , grouping by field1 (      MIM_TBL.RETAIL_SHIPMENT_T.Rtl_Id      ,MIM_TBL.RETAIL_EXTN_T.Key_Acct_Id      ,MIM_TBL.RETAIL_T.Lvl_1_Mgmt_Acct_Nm ,MIM_TBL.RETAIL_T.Region_Id      ,MIM_TBL.RETAIL_T.Section_Id ,MIM_TBL.RETAIL_T.District_Id      ,MIM_TBL.RETAIL_T.Unit_Id ,MIM_TBL.RETAIL_T.Territory_Id).       Aggregate Intermediate Results are computed globally, then placed      in Spool 5.  The size of Spool 5 is estimated with no confidence      to be 484,812 rows (81,448,416 bytes).  The estimated time for      this step is 0.49 seconds.    7) Finally, we send out an END TRANSACTION step to all AMPs involved      in processing the request.   -> The contents of Spool 5 are sent back to the user as the result of      statement 1.  The total estimated time is 4.61 seconds.      Explain with the PROD_ID Filter   1) First, we lock MIM_TBL.RETAIL_SHIPMENT_T in view      mim.RETAIL_SHIPMENT for access, we lock MIM_TBL.RETAIL_T in view      mim.RETAIL for access, and we lock MIM_TBL.RETAIL_EXTN_T in view      mim.Retail_Extn for access.    2) Next, we execute the following steps in parallel.         1) We do a single-AMP RETRIEVE step from MIM_TBL.PRODUCT_T in           view mim.Product by way of the unique primary index           "MIM_TBL.PRODUCT_T in view mim.Product.Prod_Id = 7683" with a           residual condition of ("(MIM_TBL.PRODUCT_T in view           mim.Product.Brand_Family_Id = 1489) AND ((MIM_TBL.PRODUCT_T           in view mim.Product.Company_Id = 59) AND (MIM_TBL.PRODUCT_T           in view mim.Product.Catg_Id = 3 ))") locking row for access           into Spool 9 (all_amps) (compressed columns allowed), which           is duplicated on all AMPs.  The size of Spool 9 is estimated           with high confidence to be 72 rows (1,224 bytes).  The           estimated time for this step is 0.01 seconds.         2) We do a BMSMS (bit map set manipulation) step that builds a           bit map for MIM_TBL.RETAIL_SHIPMENT_T in view           mim.RETAIL_SHIPMENT by way of a traversal of index # 8 which           is placed in Spool 8.  The estimated time for this step is           0.27 seconds.    3) We do an all-AMPs JOIN step from Spool 9 (Last Use) by way of an      all-rows scan, which is joined to MIM_TBL.RETAIL_SHIPMENT_T in      view mim.RETAIL_SHIPMENT by way of index # 4      "MIM_TBL.RETAIL_SHIPMENT_T in view mim.RETAIL_SHIPMENT.Prod_Id =      7683" and the bit map in Spool 8 (Last Use) with a residual      condition of ("(MIM_TBL.RETAIL_SHIPMENT_T in view      mim.RETAIL_SHIPMENT.Shipment_Dt = DATE '2013-02-16') OR      (MIM_TBL.RETAIL_SHIPMENT_T in view mim.RETAIL_SHIPMENT.Shipment_Dt      = DATE '2012-02-18')").  Spool 9 and MIM_TBL.RETAIL_SHIPMENT_T are      joined using a product join, with a join condition of (      "MIM_TBL.RETAIL_SHIPMENT_T.Prod_Id = Prod_Id").  The input table      MIM_TBL.RETAIL_SHIPMENT_T will not be cached in memory, but it is      eligible for synchronized scanning.  The result goes into Spool 10      (all_amps) (compressed columns allowed), which is built locally on      the AMPs.  Then we do a SORT to order Spool 10 by the hash code of      (MIM_TBL.RETAIL_SHIPMENT_T.Rtl_Id).  The size of Spool 10 is      estimated with low confidence to be 30,868 rows (524,756 bytes).       The estimated time for this step is 0.26 seconds.    4) We do an all-AMPs JOIN step from MIM_TBL.RETAIL_EXTN_T in view      mim.Retail_Extn by way of a RowHash match scan with no residual      conditions, which is joined to Spool 10 (Last Use) by way of a      RowHash match scan.  MIM_TBL.RETAIL_EXTN_T and Spool 10 are joined      using a merge join, with a join condition of ("Rtl_Id =      MIM_TBL.RETAIL_EXTN_T.Rtl_Id").  The result goes into Spool 11      (all_amps) (compressed columns allowed), which is built locally on      the AMPs.  The size of Spool 11 is estimated with low confidence      to be 30,868 rows (956,908 bytes).  The estimated time for this      step is 0.48 seconds.    5) We do an all-AMPs JOIN step from MIM_TBL.RETAIL_T in view      mim.RETAIL by way of a RowHash match scan with no residual      conditions, which is joined to Spool 11 (Last Use) by way of a      RowHash match scan.  MIM_TBL.RETAIL_T and Spool 11 are joined      using a merge join, with a join condition of ("(Rtl_Id =      MIM_TBL.RETAIL_T.Rtl_Id) AND (Rtl_Id = MIM_TBL.RETAIL_T.Rtl_Id)").       The result goes into Spool 7 (all_amps) (compressed columns      allowed), which is built locally on the AMPs.  The size of Spool 7      is estimated with low confidence to be 30,868 rows (2,099,024      bytes).  The estimated time for this step is 0.13 seconds.    6) We do an all-AMPs SUM step to aggregate from Spool 7 (Last Use) by      way of an all-rows scan , grouping by field1 (      MIM_TBL.RETAIL_SHIPMENT_T.Rtl_Id      ,MIM_TBL.RETAIL_EXTN_T.Key_Acct_Id      ,MIM_TBL.RETAIL_T.Lvl_1_Mgmt_Acct_Nm ,MIM_TBL.RETAIL_T.Region_Id      ,MIM_TBL.RETAIL_T.Section_Id ,MIM_TBL.RETAIL_T.District_Id      ,MIM_TBL.RETAIL_T.Unit_Id ,MIM_TBL.RETAIL_T.Territory_Id).       Aggregate Intermediate Results are computed globally, then placed      in Spool 5.  The size of Spool 5 is estimated with low confidence      to be 30,868 rows (5,185,824 bytes).  The estimated time for this      step is 0.05 seconds.    7) Finally, we send out an END TRANSACTION step to all AMPs involved      in processing the request.   -> The contents of Spool 5 are sent back to the user as the result of      statement 1.  The total estimated time is 1.19 seconds.   

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>