DIeter - Plan wise, second one more efficient but its taking 4 secs without PROD_ID filter whereas the first one is takinf almost 6 mins.
Unfortunately I can not access DBQL tables.
Regarding BMSMS. both the below queries has a BMSMS even if one query has just one filter clause. Table has a NUSI on Shipment_Dt as well as Prod_Id. Not sure why in the second query its still creating a BMSMS
Select *
FROM mim.RETAIL_SHIPMENT S
WHere Prod_ID = 7683
And shipment_dt in ('2012-02-18','2013-02-16')
1) First, we lock MIM_TBL.RETAIL_SHIPMENT_T in view
mim.RETAIL_SHIPMENT for access.
2) Next, 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 3.
The estimated time for this step is 0.14 seconds.
3) We do an all-AMPs RETRIEVE step from 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 3 (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')") into Spool 2 (all_amps), which is built
locally on the AMPs. The input table will not be cached in memory,
but it is eligible for synchronized scanning. The size of Spool 2
is estimated with high confidence to be 19,732 rows (2,841,408
bytes). The estimated time for this step is 0.03 seconds.
4) Finally, we send out an END TRANSACTION step to all AMPs involved
in processing the request.
-> The contents of Spool 2 are sent back to the user as the result of
statement 1. The total estimated time is 0.17 seconds.
Select *
FROM mim.RETAIL_SHIPMENT S
WHere Prod_ID = 7683
1) First, we lock MIM_TBL.RETAIL_SHIPMENT_T in view
mim.RETAIL_SHIPMENT for access.
2) Next, 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 3.
The estimated time for this step is 0.00 seconds.
3) We do an all-AMPs RETRIEVE step from 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 3 (Last Use) with no residual
conditions into Spool 2 (all_amps), which is built locally on the
AMPs. The input table will not be cached in memory, but it is
eligible for synchronized scanning. The size of Spool 2 is
estimated with high confidence to be 753,379 rows (108,486,576
bytes). The estimated time for this step is 1.20 seconds.
4) Finally, we send out an END TRANSACTION step to all AMPs involved
in processing the request.
-> The contents of Spool 2 are sent back to the user as the result of
statement 1. The total estimated time is 1.20 seconds.
↧