![](//teradataforum.com/imgs/ptdfw1.gif) |
![](//teradataforum.com/imgs/ptdfw2.gif) |
Archives of the TeradataForum
Message Posted: Fri, 06 Jan 2012 @ 20:41:21 GMT
Subj: | | Improving the performance of a minus query |
|
From: | | Bodla, Sravan Kumar |
Hi,
Can some please help me to tune this query.
Stats are fine on the tables.
SELECT
Gl_Pst_Transaction_Typ_Cd
,Gl_Pst_Source_Cd
,Source_Cd
,Agmt_Gl_Pst_Typ_Cd
,Coa_Crncy_Id
,Coa_Temporary_Dimension
,Gl_Mn_Acct_Id
,Coa_Comp_Cd_Party_Id
,Coa_Actg_Unit_Party_Id
,Gl_Customer_Grp_Party_Grp_Id
,Cntpty_Comp_Cd_Party_Id
,Cntpty_Actg_Unit_Party_Id
,Gl_Pst_Book_Typ_Cd
,Agmt_Gl_Pst_Cr_Ind
,Agmt_Gl_Pst_Txt
,GL_Posting_Product_Service_Id
,Agmt_Gl_Pst_Party_Id
,Agmt_Gl_Pst_Document_Typ_Cd
FROM PROD_INT_CORE_AUDIT.N0001_AGREEMENT_GL_POSTING
where Coa_Crncy_Id IN (1000000000104,
1000000000124)
Minus
SELECT
Gl_Pst_Transaction_Typ_Cd
,Gl_Pst_Source_Cd
,Source_Cd
,Agmt_Gl_Pst_Typ_Cd
,Coa_Crncy_Id
,Coa_Temporary_Dimension
,Gl_Mn_Acct_Id
,Coa_Comp_Cd_Party_Id
,Coa_Actg_Unit_Party_Id
,Gl_Customer_Grp_Party_Grp_Id
,Cntpty_Comp_Cd_Party_Id
,Cntpty_Actg_Unit_Party_Id
,Gl_Pst_Book_Typ_Cd
,Agmt_Gl_Pst_Cr_Ind
,Agmt_Gl_Pst_Txt
,GL_Posting_Product_Service_Id
,Agmt_Gl_Pst_Party_Id
,Agmt_Gl_Pst_Document_Typ_Cd
FROM
PROD_INT_SL_DIM_TARGET.N0001_AGMNT_GL_PST_DIM
where Coa_Crncy_Id IN (1000000000104,
1000000000124)
COUNT OF 1st table = 117, 126, 8917
Count of 2nd table = 90, 278, 816
Thanks,
Sravan.
| |