we have two derived tables, with exact same logic, one is the generic table, another one is the alias table. once I put them both on a report, each with one data provider, it extremely slow down the performace. what should i do now? Make it a view, would that sovle the problem?
I tired to put them both in one data provider, then I got “Context” issue, i believe it’s because they needs to be in two dataproviders to merge them.
here is the SQL
SELECT
(case when CPTY_EXPSR_FCT.FWD_FLG = ‘F’ then ‘Forward’ when CPTY_EXPSR_FCT.FWD_FLG = ‘S’ then ‘Settled’ end) As “Forward Indicator”,
(case when CPTY_EXPSR_FCT.MRGN_CALL_FLG = ‘E’ then ‘Exclude’ when CPTY_EXPSR_FCT.MRGN_CALL_FLG = ‘N’ then ‘Not a Margin Call’ end) As “Margin Call”,
CPTY_EXPSR_FCT.TRIPTY_CD As “Triparty Code”,
CPTY_EXPSR_FCT.ASET_ALOCN_CD As “New Shell”,
CPTY_EXPSR_FCT.MKT_VALUE_USD As “Market Value”,
(case when TBF_BCKTS_DIM.TBF_BCKT_CD=‘720+’ then ‘+’ else TBF_BCKTS_DIM.TBF_BCKT_CD end) As “Bucket Code” ,
(case
when
CPTY_EXPSR_FCT.TRD_DIRCT_FLG = ‘A’
then
‘Asset’
when
CPTY_EXPSR_FCT.TRD_DIRCT_FLG = ‘L’
then
‘Liability’
else
‘0’
end) As “Trade Direction”,
( case when CPTY_EXPSR_FCT.CPTY_EXTL_INTRNL_FLG = ‘E’ then ‘Ext’ when CPTY_EXPSR_FCT.CPTY_EXTL_INTRNL_FLG = ‘I’ then ‘Int’ end) As “Ext\Int Indicator”,
CPTY_EXPSR_FCT.MKT_VALUE_USD As “Cash/Market Value”,
CPTY_EXPSR_FCT.SRC_DATA_BUS_DTE As “Source Business Date”
FROM
CPTY_EXPSR_FCT,
TBF_BCKTS_DIM,
SEC_SBCATG_DIM SEC_SBCATG_DIM_ALIAS_CPTY
WHERE
( CPTY_EXPSR_FCT.BCKT_DW_KEY=TBF_BCKTS_DIM.TBF_BCKTS_DW_KEY )
AND ( CPTY_EXPSR_FCT.SEC_SBCATG_DW_KEY=SEC_SBCATG_DIM_ALIAS_CPTY.SEC_SBCATG_DW_KEY )
AND ( ( CPTY_EXPSR_FCT.TRIPTY_CD ) IN (‘Alocn’, ‘Nontriparty’) )
–AND ( ( CPTY_EXPSR_FCT.TRIPTY_CD ) IN (‘Shell’, ‘Nontriparty’) )
AND
(
CPTY_EXPSR_FCT.SRC_DATA_BUS_DTE = @prompt(‘Enter Business Date:’,‘D’,‘Counterparty Concentration\Source System Business Date’,Mono,Free,)
AND
CPTY_EXPSR_FCT.ASET_ALOCN_CD = @prompt(‘Enter for New Shell:’,‘A’,‘Counterparty Concentration\New Shell’,Mono,Free,)
AND
( CPTY_EXPSR_FCT.RGN_CD=‘AMERS’ )
AND
( SEC_SBCATG_DIM_ALIAS_CPTY.TBF_INCL_EXCL_FLG=‘N’ )
AND
‘Market’ = @prompt(‘Select Cash/Market Value:’,‘A’,{‘Cash’,‘Market’},Mono,Free,)
)
UNION ALL
SELECT
(case when CPTY_EXPSR_FCT.FWD_FLG = ‘F’ then ‘Forward’ when CPTY_EXPSR_FCT.FWD_FLG = ‘S’ then ‘Settled’ end) As “Forward Indicator”,
(case when CPTY_EXPSR_FCT.MRGN_CALL_FLG = ‘E’ then ‘Exclude’ when CPTY_EXPSR_FCT.MRGN_CALL_FLG = ‘N’ then ‘Not a Margin Call’ end) As “Margin Call”,
CPTY_EXPSR_FCT.TRIPTY_CD As “Triparty Code”,
CPTY_EXPSR_FCT.ASET_ALOCN_CD As “New Shell”,
CPTY_EXPSR_FCT.CSH_USD*(-1) As “Cash Value”,
(case when TBF_BCKTS_DIM.TBF_BCKT_CD=‘720+’ then ‘+’ else TBF_BCKTS_DIM.TBF_BCKT_CD end) As “Bucket Code” ,
(case
when
CPTY_EXPSR_FCT.TRD_DIRCT_FLG = ‘A’
then
‘Asset’
when
CPTY_EXPSR_FCT.TRD_DIRCT_FLG = ‘L’
then
‘Liability’
else
‘0’
end) As “Trade Direction”,
( case when CPTY_EXPSR_FCT.CPTY_EXTL_INTRNL_FLG = ‘E’ then ‘Ext’ when CPTY_EXPSR_FCT.CPTY_EXTL_INTRNL_FLG = ‘I’ then ‘Int’ end) As “Ext\Int Indicator”,
–CPTY_EXPSR_FCT.CSH_USD As “Cash Value”,
CPTY_EXPSR_FCT.CSH_USD As “Cash/Market Value”,
CPTY_EXPSR_FCT.SRC_DATA_BUS_DTE As “Source Business Date”
FROM
CPTY_EXPSR_FCT,
TBF_BCKTS_DIM,
SEC_SBCATG_DIM SEC_SBCATG_DIM_ALIAS_CPTY
WHERE
( CPTY_EXPSR_FCT.BCKT_DW_KEY=TBF_BCKTS_DIM.TBF_BCKTS_DW_KEY )
AND ( CPTY_EXPSR_FCT.SEC_SBCATG_DW_KEY=SEC_SBCATG_DIM_ALIAS_CPTY.SEC_SBCATG_DW_KEY )
– AND ( ( CPTY_EXPSR_FCT.TRIPTY_CD ) IN (‘Alocn’, ‘Nontriparty’) )
AND ( ( CPTY_EXPSR_FCT.TRIPTY_CD ) IN (‘Shell’, ‘Nontriparty’) )
AND
(
CPTY_EXPSR_FCT.SRC_DATA_BUS_DTE = @prompt(‘Enter Business Date:’,‘D’,‘Counterparty Concentration\Source System Business Date’,Mono,Free,)
AND
CPTY_EXPSR_FCT.ASET_ALOCN_CD = @prompt(‘Enter for New Shell:’,‘A’,‘Counterparty Concentration\New Shell’,Mono,Free,)
AND
( CPTY_EXPSR_FCT.RGN_CD=‘AMERS’ )
AND
( SEC_SBCATG_DIM_ALIAS_CPTY.TBF_INCL_EXCL_FLG=‘N’ )
AND
‘Cash’ = @prompt(‘Select Cash/Market Value:’,‘A’,{‘Cash’,‘Market’},Mono,Free,)
)
lavinaluo (BOB member since 2005-02-14)