I was trying to do a left outer join and kept getting the wrong row count. I did an explain plan on the query and
found out that for some reason the parser was doing a right outer join. I have attached the sql and corresponding step of the explain plan. Am I doing something wrong in my syntax?
TIA
Craig
explain INSERT INTO dss_tables.sales2 (
date_loaded,
branch_id,
customer_no,
sim_mfr_no,
product_code,
product_category,
shipment_type,
outside_sales_no,
sales,
cost,
region_id,
group_id,
parent_mfr,
mfr_name,
industry_code,
country_code,
bridge_code)
SELECT s.date_loaded,
s.branch_id,
s.customer_no,
s.sim_mfr_no,
s.product_code,
s.product_category,
s.shipment_type,
s.outside_sales_no,
s.sales,
s.cost,
s.region_id,
s.group_id,
p.mfg_desc,
s.mfr_name,
s.industry_code,
s.country_code,
s.bridge_code
FROM dss_tables.sales s
LEFT OUTER JOIN dss_tables.pmna_supplier p ON
s.country_code = p.country_code
AND s.sim_mfr_no = p.mfg_num;
6) We do an all-AMPs JOIN step from dss_tables.p by way of a RowHash
match scan with no residual conditions, which is joined to Spool 2
(Last Use). dss_tables.p and Spool 2 are right outer joined using
a merge join, with a join condition of ("(sim_mfr_no =
dss_tables.p.mfg_num) AND (country_code =
dss_tables.p.country_code)". The result goes into Spool 1, which
is redistributed by hash code to all AMPs. Then we do a SORT to
order Spool 1 by row hash. The size of Spool 1 is estimated with
low confidence to be 551,513 rows. The estimated time for this
step is 20 minutes and 41 seconds.
found out that for some reason the parser was doing a right outer join. I have attached the sql and corresponding step of the explain plan. Am I doing something wrong in my syntax?
TIA
Craig
explain INSERT INTO dss_tables.sales2 (
date_loaded,
branch_id,
customer_no,
sim_mfr_no,
product_code,
product_category,
shipment_type,
outside_sales_no,
sales,
cost,
region_id,
group_id,
parent_mfr,
mfr_name,
industry_code,
country_code,
bridge_code)
SELECT s.date_loaded,
s.branch_id,
s.customer_no,
s.sim_mfr_no,
s.product_code,
s.product_category,
s.shipment_type,
s.outside_sales_no,
s.sales,
s.cost,
s.region_id,
s.group_id,
p.mfg_desc,
s.mfr_name,
s.industry_code,
s.country_code,
s.bridge_code
FROM dss_tables.sales s
LEFT OUTER JOIN dss_tables.pmna_supplier p ON
s.country_code = p.country_code
AND s.sim_mfr_no = p.mfg_num;
6) We do an all-AMPs JOIN step from dss_tables.p by way of a RowHash
match scan with no residual conditions, which is joined to Spool 2
(Last Use). dss_tables.p and Spool 2 are right outer joined using
a merge join, with a join condition of ("(sim_mfr_no =
dss_tables.p.mfg_num) AND (country_code =
dss_tables.p.country_code)". The result goes into Spool 1, which
is redistributed by hash code to all AMPs. Then we do a SORT to
order Spool 1 by row hash. The size of Spool 1 is estimated with
low confidence to be 551,513 rows. The estimated time for this
step is 20 minutes and 41 seconds.