Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Performance tuning - response (3) by Asit

$
0
0
HI,   I have a table containing 19 million records. I am executing a query having inner join. The query is taking huge time. Can anybody suggest me query tuning  option? the query is: SELECT BOXINVTRY_HIST_SRC.CORP, BOXINVTRY_HIST_SRC.BNUMB, BOXINVTRY_HIST_SRC.REPLICATION_HOSTNAME, CAST(CAST(BOXINVTRY_HIST_SRC.INCREMENTAL_LOAD_START_TS AS DATE FORMAT'YYYY-MM-DD') AS VARCHAR(30)) AS AUDIT_PROCESS_DT, CAST(CURRENT_TIMESTAMP(0) AS VARCHAR(30)) AS AUDIT_UPDATED_TS, CAST(BOXINVTRY_HIST_SRC.AUDIT_DML_TS AS VARCHAR(30)) AS RECORD_END_TS, CAST(BOXINVTRY_TAR.RECORD_START_TS AS VARCHAR(30)) AS RECORD_START_TS FROM NDW_ETL_WORK.WRK_BOXINVTRY BOXINVTRY_HIST_SRC INNER JOIN NDW_JRNL_TABLES.BOXINVTRY BOXINVTRY_TAR ON BOXINVTRY_HIST_SRC.CORP = BOXINVTRY_TAR.CORP AND Trim(BOXINVTRY_HIST_SRC.BNUMB) = Trim(BOXINVTRY_TAR.BNUMB) AND Trim(BOXINVTRY_HIST_SRC.REPLICATION_HOSTNAME) = Trim(BOXINVTRY_TAR.REPLICATION_HOSTNAME) WHERE BOXINVTRY_HIST_SRC.REPLICATION_DML_ACTION_CD IN ('I','U','S') AND BOXINVTRY_TAR.RECORD_END_TS = '9999-12-31 00:00:00' AND ( COALESCE(Trim(BOXINVTRY_HIST_SRC.ADDLEQ),'') <> COALESCE(Trim(BOXINVTRY_TAR.ADDLEQ), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.BEQUIP),'') <> COALESCE(Trim(BOXINVTRY_TAR.BEQUIP), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.MFG),'') <> COALESCE(Trim(BOXINVTRY_TAR.MFG), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.LOT),'') <> COALESCE(Trim(BOXINVTRY_TAR.LOT), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.PREVHOUSE),'') <> COALESCE(Trim(BOXINVTRY_TAR.PREVHOUSE), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.PREVCUST),'') <> COALESCE(Trim(BOXINVTRY_TAR.PREVCUST), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.OPTN1),'') <> COALESCE(Trim(BOXINVTRY_TAR.OPTN1), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.OPTN2),'') <> COALESCE(Trim(BOXINVTRY_TAR.OPTN2), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.OPTN3),'') <> COALESCE(Trim(BOXINVTRY_TAR.OPTN3), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.LOC),'') <> COALESCE(Trim(BOXINVTRY_TAR.LOC), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.PLACE),'') <> COALESCE(Trim(BOXINVTRY_TAR.PLACE), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.RECSTAT),'') <> COALESCE(Trim(BOXINVTRY_TAR.RECSTAT), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.BXSTATUS),'') <> COALESCE(Trim(BOXINVTRY_TAR.BXSTATUS), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.ADDRSABLE),'') <> COALESCE(Trim(BOXINVTRY_TAR.ADDRSABLE), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.EVTCPBL),'') <> COALESCE(Trim(BOXINVTRY_TAR.EVTCPBL), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.LASTPROG),'') <> COALESCE(Trim(BOXINVTRY_TAR.LASTPROG), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.BRGPIN),'') <> COALESCE(Trim(BOXINVTRY_TAR.BRGPIN), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.BRGRATG),'') <> COALESCE(Trim(BOXINVTRY_TAR.BRGRATG), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.BRGPPV),'') <> COALESCE(Trim(BOXINVTRY_TAR.BRGPPV), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.BRGEMG),'') <> COALESCE(Trim(BOXINVTRY_TAR.BRGEMG), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.CABLE),'') <> COALESCE(Trim(BOXINVTRY_TAR.CABLE), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.FMT),'') <> COALESCE(Trim(BOXINVTRY_TAR.FMT), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.TIERS),'') <> COALESCE(Trim(BOXINVTRY_TAR.TIERS), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.SPCLS),'') <> COALESCE(Trim(BOXINVTRY_TAR.SPCLS), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.HUB),'') <> COALESCE(Trim(BOXINVTRY_TAR.HUB), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.TINITFLAG),'') <> COALESCE(Trim(BOXINVTRY_TAR.TINITFLAG), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.NORESP),'') <> COALESCE(Trim(BOXINVTRY_TAR.NORESP), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.DWO),'') <> COALESCE(Trim(BOXINVTRY_TAR.DWO), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.HOUSE),'') <> COALESCE(Trim(BOXINVTRY_TAR.HOUSE), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.CUST),'') <> COALESCE(Trim(BOXINVTRY_TAR.CUST), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.WPCNT),'') <> COALESCE(Trim(BOXINVTRY_TAR.WPCNT), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.OPAID),'') <> COALESCE(Trim(BOXINVTRY_TAR.OPAID), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.OPADROP),'') <> COALESCE(Trim(BOXINVTRY_TAR.OPADROP), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.OPASUBMOD),'') <> COALESCE(Trim(BOXINVTRY_TAR.OPASUBMOD), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.PARTITION),'') <> COALESCE(Trim(BOXINVTRY_TAR.PARTITION), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.OPR),'') <> COALESCE(Trim(BOXINVTRY_TAR.OPR), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.BOXEQUIP),'') <> COALESCE(Trim(BOXINVTRY_TAR.BOXEQUIP), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.NVODCAPABLE),'') <> COALESCE(Trim(BOXINVTRY_TAR.NVODCAPABLE), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.IPPVPIN),'') <> COALESCE(Trim(BOXINVTRY_TAR.IPPVPIN), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.UNIT_ADD),'') <> COALESCE(Trim(BOXINVTRY_TAR.UNIT_ADD), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.PREVTIERS),'') <> COALESCE(Trim(BOXINVTRY_TAR.PREVTIERS), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.DELIVERYSYSID),'') <> COALESCE(Trim(BOXINVTRY_TAR.DELIVERYSYSID), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.MODEL),'') <> COALESCE(Trim(BOXINVTRY_TAR.MODEL), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.MACADDRESS),'') <> COALESCE(Trim(BOXINVTRY_TAR.MACADDRESS), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.IPADDR),'') <> COALESCE(Trim(BOXINVTRY_TAR.IPADDR), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.MODEMID),'') <> COALESCE(Trim(BOXINVTRY_TAR.MODEMID), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.EQUIP_VERSION),'') <> COALESCE(Trim(BOXINVTRY_TAR.EQUIP_VERSION), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.EXPANDED_TIERS),'') <> COALESCE(Trim(BOXINVTRY_TAR.EXPANDED_TIERS), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.ADDRESS_TYPE),'') <> COALESCE(Trim(BOXINVTRY_TAR.ADDRESS_TYPE), '') OR COALESCE(Trim(BOXINVTRY_HIST_SRC.MDULOCATION_COMMENT),'') <> COALESCE(Trim(BOXINVTRY_TAR.MDULOCATION_COMMENT), '') ) GROUP BY 1,2,3,4,5,6;   The table has index on following cols: ACCTCORP,CORP and REPLICATION_HOSTNAME      

Viewing all articles
Browse latest Browse all 14773

Trending Articles



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