Performance of query in report..
Hi All,
We have the below SQL which is taking 6-8 hrs to execute. Of which 'analysis_results_details' is huge table with 329 million records, its "IOT - TOP" [index oraganised] table.
Can you please suggest some idea how to improve the performance of the query... Apologies if the format is correct tried my best
DB details :- 10g (10.1.0.5.0) - 64 bit.
SELECT CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK/Ireland'
ELSE ctr.region
END AS region_name,
t.reinsurance_treatment_desc AS reinsurance_treatment,
CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK Runoff'
ELSE rlc.country_code
END AS country_code,
ars.currency_code, rln.management_line_of_business AS aog_line,
rln.reserving_class, rln.reserving_line, rln.reserving_line_id,
CASE
WHEN UPPER (a.NAME) NOT LIKE 'PCSUMM%'
THEN ''
ELSE CASE
WHEN UPPER (a.NAME) LIKE 'PCSUMM1 %'
THEN 'Attritional'
WHEN UPPER (a.NAME) LIKE 'PCSUMM2 %'
THEN 'Large Loss'
WHEN UPPER (a.NAME) LIKE 'PCSUMM4 %'
THEN 'Total'
ELSE 'Cat'
END
END AS claim_type,
CASE
WHEN MOD (ard.exposure_period, 100) IN (1, 2, 3)
THEN TO_DATE
(TO_CHAR (TRUNC (ard.exposure_period / 100)) || '0101',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (4, 5, 6)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0401',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (7, 8, 9)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0701',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (10, 11, 12)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '1001',
'yyyymmdd'
END AS origin_date,
CASE
WHEN MOD (ard.evaluation_period, 100) IN
(1, 2, 3)
THEN TO_DATE
(TO_CHAR (TRUNC (ard.evaluation_period / 100)) || '0331',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (4, 5, 6)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0630',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (7, 8, 9)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0930',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (10, 11, 12)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '1231',
'yyyymmdd'
END AS development_date,
SUM (DECODE (ars.data_type_id, 1, NVL (ard.VALUE, 0), 0)
) AS earned_premium,
SUM (DECODE (ars.data_type_id, 12, NVL (ard.VALUE, 0), 0)
) AS paid_losses_and_alae,
SUM (DECODE (ars.data_type_id, 27, NVL (ard.VALUE, 0), 0)
) AS total_incurred_losses_inc_alae,
SUM (DECODE (ars.data_type_id, 6, NVL (ard.VALUE, 0), 0)
) AS paid_loss_total,
SUM (DECODE (ars.data_type_id, 9, NVL (ard.VALUE, 0), 0)
) AS alae_total,
SUM (DECODE (ars.data_type_id, 13, NVL (ard.VALUE, 0), 0)
) AS case_os_total,
SUM (DECODE (ars.data_type_id, 3, NVL (ard.VALUE, 0), 0)
) AS written_premium,
SUM (DECODE (ars.data_type_id, 33, NVL (ard.VALUE, 0), 0)
) AS total_claim_counts,
SUM (DECODE (ars.data_type_id, 31, NVL (ard.VALUE, 0), 0)
) AS open_claim_counts,
SUM (DECODE (ars.data_type_id, 32, NVL (ard.VALUE, 0), 0)
) AS closed_claim_counts,
SUM (DECODE (ars.data_type_id, 21, NVL (ard.VALUE, 0), 0)
) AS total_case_inc_loss,
SYSDATE AS export_date
FROM res_line_country rlc,
res_line_names rln,
risk_history.analysis_results_criteria arc,
(SELECT al.analysis_id,
MAX (al.lob_type_id) AS lob_type_id
FROM analysis_lobs al
GROUP BY analysis_id) al_types,
analyses a,
treatments t,
risk_history.analysis_lobs al,
analysis_results_summary ars,
analysis_results_details ard,
countries_to_regions ctr,
--Created Seperate Table to materialize the inline view - VM
country_to_bu_map ctbm
WHERE rlc.lob_value = rln.lob_value
AND rlc.lob_value = arc.lob_value
AND al_types.lob_type_id = rln.lob_type_id
AND a.analysis_id = al_types.analysis_id
AND a.analysis_id = arc.analysis_id
AND a.analysis_id = t.analysis_id
AND al.analysis_id = arc.analysis_id
AND arc.lob_value = al.lob_value
AND arc.analysis_criteria_id = ars.analysis_criteria_id
AND ars.analysis_results_id = ard.analysis_results_id
AND ctr.country_code = rlc.country_code
AND ctbm.business_unit = arc.business_unit
AND rlc.country_code = ctbm.country_code
AND a.run_frequency !=2
AND ars.is_non_zero_triangle = 'Y'
AND ars.data_type_id IN (1, 12, 27, 6, 9, 13, 3, 33, 31, 32, 21)
AND NOT UPPER (a.NAME) LIKE 'PCSUMM88%'
AND arc.lob_value NOT IN ('ALL', 'SEL') -- get data only for the actual reserving lines
AND al_types.lob_type_id IN (2, 4)
AND arc.management_unit != 'SEL'
AND arc.business_unit NOT IN ('ALL', 'SEL')
AND arc.rcc = 'ALL'
GROUP BY CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK/Ireland'
ELSE ctr.region
END,
t.reinsurance_treatment_desc,
CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK Runoff'
ELSE rlc.country_code
END,
ars.currency_code,
rln.management_line_of_business,
rln.reserving_class,
rln.reserving_line,
rln.reserving_line_id,
CASE
WHEN UPPER (a.NAME) NOT LIKE 'PCSUMM%'
THEN ''
ELSE CASE
WHEN UPPER (a.NAME) LIKE 'PCSUMM1 %'
THEN 'Attritional'
WHEN UPPER (a.NAME) LIKE 'PCSUMM2 %'
THEN 'Large Loss'
WHEN UPPER (a.NAME) LIKE 'PCSUMM4 %'
THEN 'Total'
ELSE 'Cat'
END
END,
CASE
WHEN MOD (ard.exposure_period, 100) IN (1, 2, 3)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0101',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (4, 5, 6)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0401',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (7, 8, 9)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0701',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (10, 11, 12)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '1001',
'yyyymmdd'
END,
CASE
WHEN MOD (ard.evaluation_period, 100) IN (1, 2, 3)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0331',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (4, 5, 6)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0630',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (7, 8, 9)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0930',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (10, 11, 12)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '1231',
'yyyymmdd') END,SYSDATE
HAVING ( SUM (DECODE (ars.data_type_id, 1, NVL (ard.VALUE, 0), 0)) <> 0
OR SUM (DECODE (ars.data_type_id, 12, NVL (ard.VALUE, 0), 0)) <>0
OR SUM (DECODE (ars.data_type_id, 27, NVL (ard.VALUE, 0), 0)) <>0
OR SUM (DECODE (ars.data_type_id, 6, NVL (ard.VALUE, 0), 0)) <> 0
OR SUM (DECODE (ars.data_type_id, 9, NVL (ard.VALUE, 0), 0)) <> 0
OR SUM (DECODE (ars.data_type_id, 13, NVL (ard.VALUE, 0), 0)) <> 0
OR SUM (DECODE (ars.data_type_id, 3, NVL (ard.VALUE, 0), 0)) <>0
OR SUM (DECODE (ars.data_type_id, 33, NVL (ard.VALUE, 0), 0)) <>0
OR SUM (DECODE (ars.data_type_id, 31, NVL (ard.VALUE, 0), 0)) <>0
OR SUM (DECODE (ars.data_type_id, 32, NVL (ard.VALUE, 0), 0)) <>0
OR SUM (DECODE (ars.data_type_id, 21, NVL (ard.VALUE, 0), 0)) <> 0 )
Below is the EXPLAIN PLAN for it
PLAN_TABLE_OUTPUT
Plan hash value: 771711397
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 256 | 356 (5)| 00:00:03 |
|* 1 | FILTER | | | | | |
| 2 | SORT GROUP BY | | 1 | 256 | 356 (5)| 00:00:03 |
| 3 | NESTED LOOPS | | 1 | 256 | 355 (4)| 00:00:03 |
| 4 | NESTED LOOPS | | 1 | 234 | 355 (4)| 00:00:03 |
| 5 | NESTED LOOPS | | 1 | 217 | 355 (4)| 00:00:03 |
| 6 | NESTED LOOPS | | 2 | 318 | 355 (5)| 00:00:03 |
| 7 | NESTED LOOPS | | 1 | 139 | 142 (10)| 00:00:02 |
| 8 | NESTED LOOPS | | 1 | 131 | 142 (10)| 00:00:02 |
| 9 | NESTED LOOPS | | 1 | 121 | 141 (10)| 00:00:02 |
|* 10 | HASH JOIN | | 1 | 111 | 140 (10)| 00:00:02 |
|* 11 | TABLE ACCESS BY INDEX ROWID | ANALYSES | 1 | 43 | 0 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 1 | 94 | 115 (8)| 00:00:01 |
| 13 | NESTED LOOPS | | 1 | 51 | 115 (8)| 00:00:01 |
|* 14 | TABLE ACCESS FULL | ANALYSIS_RESULTS_SUMMARY | 1 | 22 | 114 (8)| 00:00:01 |
|* 15 | TABLE ACCESS BY INDEX ROWID| ANALYSIS_RESULTS_CRITERIA | 1 | 29 | 1 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | ANALYSIS_RESULTS_CRITERIA_PK | 1 | | 0 (0)| 00:00:01 |
|* 17 | INDEX RANGE SCAN | ANALYSES_PK | 1 | | 0 (0)| 00:00:01 |
| 18 | VIEW | | 14 | 238 | 24 (13)| 00:00:01 |
|* 19 | FILTER | | | | | |
| 20 | SORT GROUP BY | | 14 | 98 | 24 (13)| 00:00:01 |
| 21 | TABLE ACCESS FULL | ANALYSIS_LOBS | 22909 | 156K| 21 (0)| 00:00:01 |
|* 22 | INDEX RANGE SCAN | ANALYSIS_LOBS_PK | 1 | 10 | 1 (0)| 00:00:01 |
|* 23 | INDEX FULL SCAN | COUNTRY_TO_BU_MAP_PK | 1 | 10 | 1 (0)| 00:00:01 |
|* 24 | INDEX UNIQUE SCAN | RES_LINE_COUNTRY_PK | 1 | 8 | 0 (0)| 00:00:01 |
|* 25 | INDEX RANGE SCAN | ANALYSIS_RESULTS_DETAILS_PK | 59280 | 1157K| 213 (1)| 00:00:02 |
|* 26 | TABLE ACCESS BY INDEX ROWID | RES_LINE_NAMES | 1 | 58 | 1 (0)| 00:00:01 |
|* 27 | INDEX UNIQUE SCAN | RES_LINE_NAME_PK | 1 | | 0 (0)| 00:00:01 |
| 28 | TABLE ACCESS BY INDEX ROWID | COUNTRIES_TO_REGIONS | 1 | 17 | 0 (0)| 00:00:01 |
|* 29 | INDEX UNIQUE SCAN | COUNTRIES_TO_REG_PK | 1 | | 0 (0)| 00:00:01 |
| 30 | TABLE ACCESS BY INDEX ROWID | TREATMENTS | 1 | 22 | 0 (0)| 00:00:01 |
|* 31 | INDEX UNIQUE SCAN | PK_ANALYSIS_ID | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter(SUM(DECODE("ARS"."DATA_TYPE_ID",1,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",12,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",27,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",6,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",9,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",13,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",3,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",33,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",31,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",32,NVL("ARD"."VALUE",0),0))<>0 OR
SUM(DECODE("ARS"."DATA_TYPE_ID",21,NVL("ARD"."VALUE",0),0))<>0)
10 - access("A"."ANALYSIS_ID"="AL_TYPES"."ANALYSIS_ID")
11 - filter("A"."RUN_FREQUENCY"<>2 AND UPPER("A"."NAME") NOT LIKE 'PCSUMM88%')
14 - filter("ARS"."IS_NON_ZERO_TRIANGLE"='Y' AND ("ARS"."DATA_TYPE_ID"=1 OR "ARS"."DATA_TYPE_ID"=3 OR
"ARS"."DATA_TYPE_ID"=6 OR "ARS"."DATA_TYPE_ID"=9 OR "ARS"."DATA_TYPE_ID"=12 OR "ARS"."DATA_TYPE_ID"=13 OR
"ARS"."DATA_TYPE_ID"=21 OR "ARS"."DATA_TYPE_ID"=27 OR "ARS"."DATA_TYPE_ID"=31 OR "ARS"."DATA_TYPE_ID"=32 OR
"ARS"."DATA_TYPE_ID"=33))
15 - filter("ARC"."BUSINESS_UNIT"<>'ALL' AND "ARC"."BUSINESS_UNIT"<>'SEL' AND "ARC"."LOB_VALUE"<>'SEL' AND
"ARC"."MANAGEMENT_UNIT"<>'SEL' AND "ARC"."LOB_VALUE"<>'ALL' AND "ARC"."RCC"='ALL')
16 - access("ARC"."ANALYSIS_CRITERIA_ID"="ARS"."ANALYSIS_CRITERIA_ID")
17 - access("A"."ANALYSIS_ID"="ARC"."ANALYSIS_ID")
19 - filter(MAX("AL"."LOB_TYPE_ID")=2 OR MAX("AL"."LOB_TYPE_ID")=4)
22 - access("AL"."ANALYSIS_ID"="ARC"."ANALYSIS_ID" AND "ARC"."LOB_VALUE"="AL"."LOB_VALUE")
filter("AL"."LOB_VALUE"<>'ALL' AND "AL"."LOB_VALUE"<>'SEL' AND "ARC"."LOB_VALUE"="AL"."LOB_VALUE")
23 - access("CTBM"."BUSINESS_UNIT"="ARC"."BUSINESS_UNIT")
filter("CTBM"."BUSINESS_UNIT"<>'ALL' AND "CTBM"."BUSINESS_UNIT"<>'SEL' AND
"CTBM"."BUSINESS_UNIT"="ARC"."BUSINESS_UNIT")
24 - access("RLC"."LOB_VALUE"="ARC"."LOB_VALUE" AND "RLC"."COUNTRY_CODE"="CTBM"."COUNTRY_CODE")
filter("RLC"."LOB_VALUE"<>'ALL' AND "RLC"."LOB_VALUE"<>'SEL')
25 - access("ARS"."ANALYSIS_RESULTS_ID"="ARD"."ANALYSIS_RESULTS_ID")
26 - filter((TO_NUMBER("RLN"."LOB_TYPE_ID")=4 OR TO_NUMBER("RLN"."LOB_TYPE_ID")=2) AND
"AL_TYPES"."LOB_TYPE_ID"=TO_NUMBER("RLN"."LOB_TYPE_ID"))
27 - access("RLN"."LOB_VALUE"=TO_NUMBER("RLC"."LOB_VALUE"))
29 - access("CTR"."COUNTRY_CODE"="RLC"."COUNTRY_CODE")
31 - access("A"."ANALYSIS_ID"="T"."ANALYSIS_ID")Regards,
Sundeep K
Edited by: kangula on Jan 21, 2011 4:34 PM
Edited by: kangula on Jan 21, 2011 4:36 PM
Hi Boneist,
I have checked query and it doesnt change much... execution time is same.
Hi Charles,
I have tried using the hint /*+ GATHER_PLAN_STATISTICS */ as below, the query is still executing. Its taking more than 4 hrs... Is there any other way i can get these..
set serveroutput off
SELECT /*+ GATHER_PLAN_STATISTICS */ CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK/Ireland'
ELSE ctr.region
END AS region_name,
t.reinsurance_treatment_desc AS reinsurance_treatment,
CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'Will let u know if i get these. In mean time have added new where clause [highlighted below] in query and it took 35 mins to execute. Please find it below along with plan.
explain plan for
SELECT CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK/Ireland'
ELSE ctr.region
END AS region_name,
t.reinsurance_treatment_desc AS reinsurance_treatment,
CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK Runoff'
ELSE rlc.country_code
END AS country_code,
ars.currency_code, rln.management_line_of_business AS aog_line,
rln.reserving_class, rln.reserving_line, rln.reserving_line_id,
CASE
WHEN UPPER (a.NAME) NOT LIKE 'PCSUMM%'
THEN ''
ELSE CASE
WHEN UPPER (a.NAME) LIKE 'PCSUMM1 %'
THEN 'Attritional'
WHEN UPPER (a.NAME) LIKE 'PCSUMM2 %'
THEN 'Large Loss'
WHEN UPPER (a.NAME) LIKE 'PCSUMM4 %'
THEN 'Total'
ELSE 'Cat'
END
END AS claim_type,
CASE
WHEN MOD (ard.exposure_period, 100) IN (1, 2, 3)
THEN TO_DATE
(TO_CHAR (TRUNC (ard.exposure_period / 100)) || '0101',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (4, 5, 6)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0401',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (7, 8, 9)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0701',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (10, 11, 12)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '1001',
'yyyymmdd'
END AS origin_date,
CASE
WHEN MOD (ard.evaluation_period, 100) IN
(1, 2, 3)
THEN TO_DATE
(TO_CHAR (TRUNC (ard.evaluation_period / 100)) || '0331',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (4, 5, 6)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0630',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (7, 8, 9)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0930',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (10, 11, 12)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '1231',
'yyyymmdd'
END AS development_date,
SUM (DECODE (ars.data_type_id, 1, NVL (ard.VALUE, 0), 0)
) AS earned_premium,
SUM (DECODE (ars.data_type_id, 12, NVL (ard.VALUE, 0), 0)
) AS paid_losses_and_alae,
SUM (DECODE (ars.data_type_id, 27, NVL (ard.VALUE, 0), 0)
) AS total_incurred_losses_inc_alae,
SUM (DECODE (ars.data_type_id, 6, NVL (ard.VALUE, 0), 0)
) AS paid_loss_total,
SUM (DECODE (ars.data_type_id, 9, NVL (ard.VALUE, 0), 0)
) AS alae_total,
SUM (DECODE (ars.data_type_id, 13, NVL (ard.VALUE, 0), 0)
) AS case_os_total,
SUM (DECODE (ars.data_type_id, 3, NVL (ard.VALUE, 0), 0)
) AS written_premium,
SUM (DECODE (ars.data_type_id, 33, NVL (ard.VALUE, 0), 0)
) AS total_claim_counts,
SUM (DECODE (ars.data_type_id, 31, NVL (ard.VALUE, 0), 0)
) AS open_claim_counts,
SUM (DECODE (ars.data_type_id, 32, NVL (ard.VALUE, 0), 0)
) AS closed_claim_counts,
SUM (DECODE (ars.data_type_id, 21, NVL (ard.VALUE, 0), 0)
) AS total_case_inc_loss,
SYSDATE AS export_date
FROM res_line_country rlc,
res_line_names rln,
risk_history.analysis_results_criteria arc,
(SELECT al.analysis_id,
MAX (al.lob_type_id) AS lob_type_id
FROM analysis_lobs al
GROUP BY analysis_id) al_types,
analyses a,
treatments t,
risk_history.analysis_lobs al,
analysis_results_summary ars,
analysis_results_details ard,
countries_to_regions ctr,
--Created Seperate Table to materialize the inline view - VM
country_to_bu_map ctbm
WHERE rlc.lob_value = rln.lob_value
AND rlc.lob_value = arc.lob_value
AND al_types.lob_type_id = rln.lob_type_id
AND a.analysis_id = al_types.analysis_id
AND a.analysis_id = arc.analysis_id
AND a.analysis_id = t.analysis_id
AND al.analysis_id = arc.analysis_id
AND arc.lob_value = al.lob_value
AND arc.analysis_criteria_id = ars.analysis_criteria_id
AND ars.analysis_results_id = ard.analysis_results_id
AND ctr.country_code = rlc.country_code
AND ctbm.business_unit = arc.business_unit
AND rlc.country_code = ctbm.country_code
AND a.run_frequency !=2
AND ars.is_non_zero_triangle = 'Y'
AND ars.data_type_id IN (1, 12, 27, 6, 9, 13, 3, 33, 31, 32, 21)
AND NOT UPPER (a.NAME) LIKE 'PCSUMM88%'
AND arc.lob_value NOT IN ('ALL', 'SEL') -- get data only for the actual reserving lines
AND al_types.lob_type_id IN (2, 4)
AND arc.management_unit != 'SEL'
AND arc.business_unit NOT IN ('ALL', 'SEL')
AND arc.rcc = 'ALL'
+*AND ard.VALUE <>0*+
GROUP BY CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK/Ireland'
ELSE ctr.region
END,
t.reinsurance_treatment_desc,
CASE
WHEN UPPER (a.NAME) LIKE 'PCSUM%UK%RUNOFF%'
THEN 'UK Runoff'
ELSE rlc.country_code
END,
ars.currency_code,
rln.management_line_of_business,
rln.reserving_class,
rln.reserving_line,
rln.reserving_line_id,
CASE
WHEN UPPER (a.NAME) NOT LIKE 'PCSUMM%'
THEN ''
ELSE CASE
WHEN UPPER (a.NAME) LIKE 'PCSUMM1 %'
THEN 'Attritional'
WHEN UPPER (a.NAME) LIKE 'PCSUMM2 %'
THEN 'Large Loss'
WHEN UPPER (a.NAME) LIKE 'PCSUMM4 %'
THEN 'Total'
ELSE 'Cat'
END
END,
CASE
WHEN MOD (ard.exposure_period, 100) IN (1, 2, 3)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0101',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (4, 5, 6)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0401',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (7, 8, 9)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '0701',
'yyyymmdd'
WHEN MOD (ard.exposure_period, 100) IN (10, 11, 12)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.exposure_period / 100))
|| '1001',
'yyyymmdd'
END,
CASE
WHEN MOD (ard.evaluation_period, 100) IN (1, 2, 3)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0331',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (4, 5, 6)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0630',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (7, 8, 9)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '0930',
'yyyymmdd'
WHEN MOD (ard.evaluation_period, 100) IN (10, 11, 12)
THEN TO_DATE ( TO_CHAR (TRUNC (ard.evaluation_period / 100))
|| '1231',
'yyyymmdd') END,SYSDATE
HAVING (SUM (DECODE (ars.data_type_id, 1, NVL (ard.VALUE, 0),
12, NVL (ard.VALUE, 0),
27, NVL (ard.VALUE, 0),
6, NVL (ard.VALUE, 0),
9, NVL (ard.VALUE, 0),
13, NVL (ard.VALUE, 0),
3, NVL (ard.VALUE, 0),
33, NVL (ard.VALUE, 0),
31, NVL (ard.VALUE, 0),
32, NVL (ard.VALUE, 0),
21, NVL (ard.VALUE, 0), 0)) != 0 );
select * from table (dbms_xplan.DISPLAY)
PLAN_TABLE_OUTPUT
Plan hash value: 2043043506
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 256 | 355 (5)| 00:00:03 |
|* 1 | FILTER | | | | | |
| 2 | SORT GROUP BY | | 1 | 256 | 355 (5)| 00:00:03 |
| 3 | NESTED LOOPS | | 1 | 256 | 354 (4)| 00:00:03 |
| 4 | NESTED LOOPS | | 1 | 198 | 354 (5)| 00:00:03 |
| 5 | NESTED LOOPS | | 1 | 188 | 354 (5)| 00:00:03 |
| 6 | NESTED LOOPS | | 1 | 166 | 354 (5)| 00:00:03 |
| 7 | NESTED LOOPS | | 1 | 149 | 354 (5)| 00:00:03 |
| 8 | NESTED LOOPS | | 1 | 129 | 141 (10)| 00:00:02 |
| 9 | NESTED LOOPS | | 1 | 121 | 141 (10)| 00:00:02 |
|* 10 | HASH JOIN | | 1 | 111 | 140 (10)| 00:00:02 |
|* 11 | TABLE ACCESS BY INDEX ROWID | ANALYSES | 1 | 43 | 0 (0)| 00:00:01 |
| 12 | NESTED LOOPS | | 1 | 94 | 115 (8)| 00:00:01 |
| 13 | NESTED LOOPS | | 1 | 51 | 115 (8)| 00:00:01 |
|* 14 | TABLE ACCESS FULL | ANALYSIS_RESULTS_SUMMARY | 1 | 22 | 114 (8)| 00:00:01 |
|* 15 | TABLE ACCESS BY INDEX ROWID| ANALYSIS_RESULTS_CRITERIA | 1 | 29 | 1 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | ANALYSIS_RESULTS_CRITERIA_PK | 1 | | 0 (0)| 00:00:01 |
|* 17 | INDEX RANGE SCAN | ANALYSES_PK | 1 | | 0 (0)| 00:00:01 |
| 18 | VIEW | | 14 | 238 | 24 (13)| 00:00:01 |
|* 19 | FILTER | | | | | |
| 20 | SORT GROUP BY | | 14 | 98 | 24 (13)| 00:00:01 |
| 21 | TABLE ACCESS FULL | ANALYSIS_LOBS | 22909 | 156K| 21 (0)| 00:00:01 |
|* 22 | INDEX FULL SCAN | COUNTRY_TO_BU_MAP_PK | 1 | 10 | 1 (0)| 00:00:01 |
|* 23 | INDEX UNIQUE SCAN | RES_LINE_COUNTRY_PK | 1 | 8 | 0 (0)| 00:00:01 |
|* 24 | INDEX RANGE SCAN | ANALYSIS_RESULTS_DETAILS_PK | 2964 | 59280 | 213 (1)| 00:00:02 |
| 25 | TABLE ACCESS BY INDEX ROWID | COUNTRIES_TO_REGIONS | 1 | 17 | 0 (0)| 00:00:01 |
|* 26 | INDEX UNIQUE SCAN | COUNTRIES_TO_REG_PK | 1 | | 0 (0)| 00:00:01 |
| 27 | TABLE ACCESS BY INDEX ROWID | TREATMENTS | 1 | 22 | 0 (0)| 00:00:01 |
|* 28 | INDEX UNIQUE SCAN | PK_ANALYSIS_ID | 1 | | 0 (0)| 00:00:01 |
|* 29 | INDEX RANGE SCAN | ANALYSIS_LOBS_PK | 1 | 10 | 1 (0)| 00:00:01 |
|* 30 | TABLE ACCESS BY INDEX ROWID | RES_LINE_NAMES | 1 | 58 | 1 (0)| 00:00:01 |
|* 31 | INDEX UNIQUE SCAN | RES_LINE_NAME_PK | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter(SUM(DECODE("ARS"."DATA_TYPE_ID",1,NVL("ARD"."VALUE",0),12,NVL("ARD"."VALUE",0),27,NVL("ARD"."VALUE"
,0),6,NVL("ARD"."VALUE",0),9,NVL("ARD"."VALUE",0),13,NVL("ARD"."VALUE",0),3,NVL("ARD"."VALUE",0),33,NVL("ARD"."VA
LUE",0),31,NVL("ARD"."VALUE",0),32,NVL("ARD"."VALUE",0),21,NVL("ARD"."VALUE",0),0))<>0)
10 - access("A"."ANALYSIS_ID"="AL_TYPES"."ANALYSIS_ID")
11 - filter("A"."RUN_FREQUENCY"<>2 AND UPPER("A"."NAME") NOT LIKE 'PCSUMM88%')
14 - filter("ARS"."IS_NON_ZERO_TRIANGLE"='Y' AND ("ARS"."DATA_TYPE_ID"=1 OR "ARS"."DATA_TYPE_ID"=3 OR
"ARS"."DATA_TYPE_ID"=6 OR "ARS"."DATA_TYPE_ID"=9 OR "ARS"."DATA_TYPE_ID"=12 OR "ARS"."DATA_TYPE_ID"=13 OR
"ARS"."DATA_TYPE_ID"=21 OR "ARS"."DATA_TYPE_ID"=27 OR "ARS"."DATA_TYPE_ID"=31 OR "ARS"."DATA_TYPE_ID"=32 OR
"ARS"."DATA_TYPE_ID"=33))
15 - filter("ARC"."BUSINESS_UNIT"<>'ALL' AND "ARC"."BUSINESS_UNIT"<>'SEL' AND "ARC"."LOB_VALUE"<>'SEL' AND
"ARC"."MANAGEMENT_UNIT"<>'SEL' AND "ARC"."LOB_VALUE"<>'ALL' AND "ARC"."RCC"='ALL')
16 - access("ARC"."ANALYSIS_CRITERIA_ID"="ARS"."ANALYSIS_CRITERIA_ID")
17 - access("A"."ANALYSIS_ID"="ARC"."ANALYSIS_ID")
19 - filter(MAX("AL"."LOB_TYPE_ID")=2 OR MAX("AL"."LOB_TYPE_ID")=4)
22 - access("CTBM"."BUSINESS_UNIT"="ARC"."BUSINESS_UNIT")
filter("CTBM"."BUSINESS_UNIT"<>'ALL' AND "CTBM"."BUSINESS_UNIT"<>'SEL' AND
"CTBM"."BUSINESS_UNIT"="ARC"."BUSINESS_UNIT")
23 - access("RLC"."LOB_VALUE"="ARC"."LOB_VALUE" AND "RLC"."COUNTRY_CODE"="CTBM"."COUNTRY_CODE")
filter("RLC"."LOB_VALUE"<>'ALL' AND "RLC"."LOB_VALUE"<>'SEL')
24 - access("ARS"."ANALYSIS_RESULTS_ID"="ARD"."ANALYSIS_RESULTS_ID")
filter("ARD"."VALUE"<>0)
26 - access("CTR"."COUNTRY_CODE"="RLC"."COUNTRY_CODE")
28 - access("A"."ANALYSIS_ID"="T"."ANALYSIS_ID")
29 - access("AL"."ANALYSIS_ID"="ARC"."ANALYSIS_ID" AND "ARC"."LOB_VALUE"="AL"."LOB_VALUE")
filter("AL"."LOB_VALUE"<>'ALL' AND "AL"."LOB_VALUE"<>'SEL' AND "ARC"."LOB_VALUE"="AL"."LOB_VALUE")
30 - filter((TO_NUMBER("RLN"."LOB_TYPE_ID")=4 OR TO_NUMBER("RLN"."LOB_TYPE_ID")=2) AND
"AL_TYPES"."LOB_TYPE_ID"=TO_NUMBER("RLN"."LOB_TYPE_ID"))
31 - access("RLN"."LOB_VALUE"=TO_NUMBER("RLC"."LOB_VALUE"))Kindly let me know how to go forward with this.
Regards,
Sunny
Similar Messages
-
Performance issues- query/ web reports
Hi all,
i am facing some problems related to performance in queries and in web.
In web, some times i even getting timed out errors. could any one suggest me the ways to improve the both.
regards
kiransee if this helps...
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1955ba90-0201-0010-d3aa-8b2a4ef6bbb2
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ce7fb368-0601-0010-64ba-fadc985a1f94
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/4c0ab590-0201-0010-bd9a-8332d8b4f09c
Thanks,
Raj -
Query to Report on Parallel Jobs Running
Morning!
I would like to get a query that reports on my parallel jobs.
For each minute that a procedure is running I would like to know what stages are running.
I log the whole procedure in a table called run_details and the start and end of each stage in a table called incident.
I'm running Oracle 9i
Here is some sample data based on 2 threads Expected output at the bottom
SQL>CREATE TABLE run_details
2 (run_details_key NUMBER(10)
3 ,start_time DATE
4 ,end_time DATE
5 ,description VARCHAR2(50)
6 );
SQL>CREATE TABLE incident
2 (run_details_key NUMBER(10)
3 ,stage VARCHAR2(20)
4 ,severity VARCHAR2(20)
5 ,time_stamp DATE
6 );
SQL>INSERT INTO run_details
2 VALUES (1
3 ,TO_DATE('08/10/2007 08:00','DD/MM/YYYY HH24:MI')
4 ,TO_DATE('08/10/2007 08:10','DD/MM/YYYY HH24:MI')
5 ,'Test'
6 );
SQL>INSERT INTO incident
2 VALUES (1
3 ,'Stage1'
4 ,'START'
5 ,TO_DATE('08/10/2007 08:00','DD/MM/YYYY HH24:MI')
6 );
SQL>INSERT INTO incident
2 VALUES (1
3 ,'Stage1'
4 ,'END'
5 ,TO_DATE('08/10/2007 08:08:53','DD/MM/YYYY HH24:MI:SS')
6 );
SQL>INSERT INTO incident
2 VALUES (1
3 ,'Stage2'
4 ,'START'
5 ,TO_DATE('08/10/2007 08:00','DD/MM/YYYY HH24:MI')
6 );
SQL>INSERT INTO incident
2 VALUES (1
3 ,'Stage2'
4 ,'END'
5 ,TO_DATE('08/10/2007 08:04:23','DD/MM/YYYY HH24:MI:SS')
6 );
SQL>INSERT INTO incident
2 VALUES (1
3 ,'Stage3'
4 ,'START'
5 ,TO_DATE('08/10/2007 08:04:24','DD/MM/YYYY HH24:MI:SS')
6 );
SQL>INSERT INTO incident
2 VALUES (1
3 ,'Stage3'
4 ,'END'
5 ,TO_DATE('08/10/2007 08:10','DD/MM/YYYY HH24:MI')
6 );
SQL>select * from incident;
RUN_DETAILS_KEY STAGE SEVERITY TIME_STAMP
1 Stage1 START 08/10/2007 08:00:00
1 Stage1 END 08/10/2007 08:08:53
1 Stage2 START 08/10/2007 08:00:00
1 Stage2 END 08/10/2007 08:04:23
1 Stage3 START 08/10/2007 08:04:24
1 Stage3 END 08/10/2007 08:10:00 So stages 1 and 2 run in parallel from 08:00, then at 08:04:23 stage 2 stops and a second later stage 3 starts.
set some variables
SQL>define start_time = null
SQL>col start_time new_value start_time
SQL>define end_time = null
SQL>col end_time new_value end_time
SQL>
SQL>SELECT start_time-(1/(24*60)) start_time
2 ,end_time
3 FROM run_details
4 WHERE run_details_key = 1;
START_TIME END_TIME
08/10/2007 07:59:00 08/10/2007 08:10:00Get every minute that the process is running for:
SQL>WITH t AS (SELECT TRUNC(TO_DATE('&start_time','dd/mm/yyyy hh24:mi:ss'),'MI') + rownum/24/60 tm
2 FROM dual
3 CONNECT BY ROWNUM <= (TO_DATE('&end_time','dd/mm/yyyy hh24:mi:ss')
4 -TO_DATE('&start_time','dd/mm/yyyy hh24:mi:ss')
5 )*24*60
6 )
7 SELECT tm
8 FROM t;
old 1: WITH t AS (SELECT TRUNC(TO_DATE('&start_time','dd/mm/yyyy hh24:mi:ss'),'MI') + rownum/24/60 tm
new 1: WITH t AS (SELECT TRUNC(TO_DATE('08/10/2007 07:59:00','dd/mm/yyyy hh24:mi:ss'),'MI') + rownum/24/60 tm
old 3: CONNECT BY ROWNUM <= (TO_DATE('&end_time','dd/mm/yyyy hh24:mi:ss')
new 3: CONNECT BY ROWNUM <= (TO_DATE('08/10/2007 08:10:00','dd/mm/yyyy hh24:mi:ss')
old 4: -TO_DATE('&start_time','dd/mm/yyyy hh24:mi:ss')
new 4: -TO_DATE('08/10/2007 07:59:00','dd/mm/yyyy hh24:mi:ss')
TM
08/10/2007 08:00:00
08/10/2007 08:01:00
08/10/2007 08:02:00
08/10/2007 08:03:00
08/10/2007 08:04:00
08/10/2007 08:05:00
08/10/2007 08:06:00
08/10/2007 08:07:00
08/10/2007 08:08:00
08/10/2007 08:09:00
08/10/2007 08:10:00
11 rows selected.Get stage, start & end times and duration
SQL>SELECT ai1.stage
2 ,ai1.time_stamp start_time
3 ,ai2.time_stamp end_time
4 ,SUBSTR(numtodsinterval(ai2.time_stamp-ai1.time_stamp, 'DAY'), 12, 8) duration
5 FROM dw2.incident ai1
6 JOIN dw2.incident ai2
7 ON ai1.run_details_key = ai2.run_details_key
8 AND ai1.stage = ai2.stage
9 WHERE ai1.severity = 'START'
10 AND ai2.severity = 'END'
11 AND ai1.run_details_key = 1
12 ORDER BY ai1.time_stamp
13 /
STAGE START_TIME END_TIME DURATION
Stage1 08/10/2007 08:00:00 08/10/2007 08:08:53 00:08:52
Stage2 08/10/2007 08:00:00 08/10/2007 08:04:23 00:04:22
Stage3 08/10/2007 08:04:24 08/10/2007 08:10:00 00:05:36Then combine both (or do something else) to get this:
TM THREAD_1 THREAD_2
08/10/2007 08:00:00 Stage1 Stage2
08/10/2007 08:01:00 Stage1 Stage2
08/10/2007 08:02:00 Stage1 Stage2
08/10/2007 08:03:00 Stage1 Stage2
08/10/2007 08:04:00 Stage1 Stage2
08/10/2007 08:05:00 Stage1 Stage3
08/10/2007 08:06:00 Stage1 Stage3
08/10/2007 08:07:00 Stage1 Stage3
08/10/2007 08:08:00 Stage1 Stage3
08/10/2007 08:09:00 Stage3
08/10/2007 08:10:00 Stage3Ideally I'd like this to work for n-threads, as I want this to run on different environments that have different numbers of CPUs.
Thank you for your time.> Ideally I'd like this to work for n-threads, as I want this to run on
different environments that have different numbers of CPUs.
The number of CPUs are not always a good indication of the processing load that a platform can take - especially when the processing load involves a lot of I/O.
You can have 99% CPU idle time with a 1000 active processes... as that idle time is in fact CPU time spend waiting on I/O completion. Courtesy of a severely strained I/O channel that is the bottleneck.
Another factor is memory (resources). You for example have 4 CPUs with 8GB physical memory.. where a single process (typically a Java VM for a complex process) grabs a huge amount of memory. Assuming that 4 threads/CPU or 1 threads/CPU can be a severe overestimate due to the amount of memory needed. Getting this wrong leads in turn to excessive virtual memory paging and reduces the platform's performance drastically.
CPU alone is a very poor choice when deciding on the platform's capacity to run parallel processes. -
Performance issue in Portal Reports
Hi
We are experiencing a serious performance issue, in a report, and need a urgent fix on this issue.
The report is a Reports From SQL Query report, I need to find a way to dynamically make/create the where clause otherwise I have to make the statement in a way the exclude the use of indexes.
Full-table-scan is not a valid option here; the number or records is simply too high (several millions its a datawarehouse solution). In the Developer packaged, we can make the where clause dynamically, this basic yet extremely important feature, is essential to all database application.
We need to know how to do it, and if this functionality is not natively supported, then this should be one of the priority one functionalities to implement in future releases.
However, what do I do for now?
Thank in advanceI have found a temporary workaround, by editing the where clause in the stored procedure manually. However this fix have to be done every time a change have been committed in the wizard, so it is still not a solution to go for indefinitely, but its ok for now.
-
Performance Issue with VL06O report
Hi,
We are having performance issue with VL06O report, when run with forwarding agent. It is taking about an hour with forwarding agent. The issue is with VBPA table and we found one OSS note, but it is for old versions. ours is ECC 5.0. Can anybody know the solution? If you guys need more information, please ask me.
Thanks,
SuryaSreedhar,
Thanks for you quick response. Indexes were not created for VBPA table. basis people tested by creating indexes and gave a report that it is taking more time with indexes than regular query optimizer. this is happening in the funtion forward_ag_selection.
select vbeln lifnr from vbpa
appending corresponding fields of table lt_select
where vbeln in ct_vbeln
and posnr eq posnr_initial
and parvw eq 'SP'
and lifnr in it_spdnr.
I don't see any issue with this query. I give more info later -
Validation of a Region defined as type SQL QUERY (Updateable Report)
Hi,
I am trying to perform some validation on a Region defined as type SQL QUERY (Updateable Report). The report has two columns.
One of the columns is a Select List and I would like to insure that a user cannot select the same value twice
in the report. For example, if the select list has 5 values, A, B, C, D, E, I don't want a user to be able to select
B twice in the report. I am assuming that I will need to incorporate javascript
into my validation logic in order to perform this task. If so, could someone provide some guidance? Or are there
other alternatives.
Thanks in advance,
MichaelDan,
Sorry, I didn't mean to post the question twice. I was trying to edit my original question. Thanks for the link to the website. I am new to APEX development so the website you gave me will be extremely useful to learn new development techniques.
Thanks again,
Michael -
The action cannot be performed error for Webi Report
HI,
I am getting the error The action cannot be performed error for Webi Report. I am getting this error after i save the report and open it again.This is happening for only 1 particular report. In the end i removed some of the objects from the query and added some new ones.
Strangely it worked! -
Performance Tuning of webi report BO4.0
Hi ,
I have report which has two data providers in 1st Data Provider i have 10 objects and in 2nd Data provider i have 3 objects the issue is performance report is taking 6 minutes to run.
Please help me out how we can increase the performance at Query Level.
Thanks
SivaHi
There are various levels to which you have to check to improve the performance of reports could be at connection levels, query, database etc.
some of them you can try
1. check array fetch size in relational connection parameters, deactivating array fetch size can increase the efficiency of retrieving your data, but slows server performance.
2. Setting options for the default list of values in business layer and data foundation layer
Automatic refresh - If this is selected, the list of values is automatically refreshed each time the
list is called. This can have an effect on performance each time the list of values is refreshed. You should disable this option if the list of values returns a large number of values.
3. set query stripping (Optimize query with Query Stripping in Web Intelligence - Business Intelligence (BusinessObjects) - SCN Wiki)
4. also check Performance Tuning Methods in BO
Regards,
Raghava -
Does Coloring Of Rows and Column in Query effect the Performance of Query
Hi to all,
Does Coloring of Rows and Column in Query via WAD or Report designer , will effect the performance of query.
If yes, then how.
What are the key factor should we consider while design of query in regards of Query performance.
I shall ne thankful to you for this.
Regards
Pavneet RanaThere will not be any significance perofrmance issue for Colouring the rows or columns...
But there are various performance parameters which should be looked into while designing a query...
Hope this PPT helps you.
http://www.comeritinc.com/UserFiles/file/tips%20tricks%20to%20speed%20%20NW%20BI%20%202009.ppt
rgds, Ghuru -
Performance tuning of a report.
hello all,
I have been assigned a report to improve the performance.Initially after studying the report i found that all the data was fetched by using select * from... query,hence i changed the query by selectin the particular feilds from the tables.the tables used in my report r bsid and bsad majorly..after these changes there was not much of a diff in the performance,after tracing the report thru st05 it was realized that the select for bsad is taking the max time to fetch..as bsad is a huge table and has huge amount of data..is ther any way i can reduce this time..by using indexes n all..can u please provide me with an example to reduce the time taken for fetchin data from bsid and bsad..
thanks and regards,
seema.hello again,
SELECT
KUNNR
UMSKZ
AUGDT
AUGBL
ZUONR
GJAHR
BELNR
BUZEI
BUDAT
BLDAT
WAERS
XBLNR
BLART
MONAT
BSCHL
SHKZG
GSBER
DMBTR
SGTXT
AUFNR
HKONT
ZFBDT
ZTERM
SKNTO
REBZG
MANSP
MSCHL
MADAT
MANST
MABER
MWSK1
VBELN
XREF1
XREF2
KKBER
EMPFB
PRCTR
XREF3
QSSKZ
BUPLA
FROM BSAD
INTO CORRESPONDING FIELDS OF TABLE T_BSID_TEMP
WHERE KUNNR IN S_KUNNR
and BUKRS = P_BUKRS
AND AUGDT GT S_BUDAT-HIGH
AND GSBER IN S_GSBER
AND BUDAT IN S_BUDAT
AND BLDAT IN S_BLDAT
AND KKBER IN S_KKBER
AND XREF1 IN s_wERKS
AND UMSKZ NOT IN ('B', 'G')
AND BSTAT NOT IN ('S').
if this is my select qury and these r the selection criteria in the wher condition how could i modify the query for better performance,
Regards,
seema. -
Is there a simple way to refresh a SQL Query (Updatable report) region
I have a page in APex 4.1 that has many regions. I would like to be able to refresh a single region.
Currently, I have the following
Region (sql query updateable report).
STATIC ID = LANDINGS
in the region footer, I have:
<script type="text/javascript">
$s('P110_LANDINGS_REGION_ID','#REGION_STATIC_ID#');
</script>
P110_LANDINGS_REGION_ID is a hidden field.
I use javascript to refresh....but it does not seem to be working. Previously, we had hard-coded the region id ( $a_report('1363338167540162011','1','100','100');) ...but that ID was somehow corrupted, which has lead me to the 'OMG...there must be an easier way!' lament.
the javascript is:
$a_report('P110_LANDINGS_REGION_ID','1','100','100');
thanks!
Karen
ps. could I just directly reference the static id in my javascript...
$a_report('LANDINGS','1','100','100');Karen,
First off: please post code in {code}...{code} tags!
function AddFavoriteSpecies()
get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=favorite_species_collection',0);
gReturn = get.get();
rowCount = rowCount + parseInt(gReturn);
pHMS_add = '&G_HMS_FLAG.';
$a_report('1363338167540162011','1','100','100');
//$a_report($x('P110_LANDINGS_ID').value,'1','15','15');the statement:
$a_report('1363338167540162011','1','100','100'); works, but the statement $a_report($x('P110_LANDINGS_ID').value,'1','15','15'); does not.
Can anyone help.
I am assigning the page field P110_LANDINGS_ID in the footer of a region with a static id = LANDINGS.
<script type="text/javascript">
$s('P110_LANDINGS_ID','#REGION_STATIC_ID#');
</script>
Well, let's start by dumping $a_report. This is undocumented code, and it has long been replaced by triggering a refresh.
Next, don't use $x(pNode).value to retrieve a value. Rather use $v(pNode) to do this.
function AddFavoriteSpecies()
get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=favorite_species_collection',0);
gReturn = get.get();
rowCount = rowCount + parseInt(gReturn);
pHMS_add = '&G_HMS_FLAG.';
//get the region id from the item
//use it in a jQuery selector to get the region
//trigger the refresh event on this object
$("#" + $v('P110_LANDINGS_ID')).trigger('apexrefresh');
}Now if you want to make sure that P110_LANDINGS_ID contains a value, add an alert with its value before you use it.
alert('P110_LANDINGS_ID value: '+$v('P110_LANDINGS_ID')) -
SQL Query (updateable report) Region - Conditionally Hide and Set Values
SQL Query (updateable report) Region - Conditionally Hide and Set Values
Outline of requirement :-
Master / Detail page with Detail updated on same page using SQL Query (updateable report).
The detail region has the following source
SELECT item_id,
contract_id,
CASE WHEN hardware_id IS NOT NULL THEN
'HA'
WHEN backup_dev_id IS NOT NULL THEN
'BD'
WHEN hardware_os_id IS NOT NULL THEN
'HS'
END item_type,
hardware_id,
backup_dev_id,
hardware_os_id
FROM "#OWNER#".support_items
WHERE contract_id = :P26_CONTRACT_IDThe table support_items implements arced relationships and has the following columns
CREATE TABLE SUPPORT_ITEMS
ITEM_ID NUMBER NOT NULL,
CONTRACT_ID NUMBER NOT NULL,
HARDWARE_ID NUMBER,
BACKUP_DEV_ID NUMBER,
HARDWARE_OS_ID NUMBER
)A check type constaint on support_items ensures that only one of the fk's is present.
( hardware_id IS NOT NULL
AND backup_dev_id IS NULL
AND hardware_os_id IS NULL
OR ( hardware_id IS NULL
AND backup_dev_id IS NOT NULL
AND hardware_os_id IS NULL
OR ( hardware_id IS NULL
AND backup_dev_id IS NULL
AND hardware_os_id IS NOT NULL
) Hardware_Id is a FK to Hardware_Assets
Backup_dev_id is a FK to Backup_Devices
Hardware_os_id is a FK to Hardware_op_systems
The Tabular Form Element based on item_type column of SQL query is Displayed As Select List (based on LOV) referencing a named list of values which have the following properties
Display Value Return Value
Hardware Asset HA
Backup Device BD
Computer System HSThe Tabular Form Elements for the report attributes for hardware_id, backup_dev_id and hardware_os_id are all Displayed As Select List (Based on LOV).
What I want to do is only display the Select List for the FK depending on the value of the Select List on Item Type, e.g.
Item_Type is 'HA' then display Select List for hardware_id, do not display and set to NULL the Select Lists for backup_dev_id and hardware_os_id.
Item_Type is 'BB' then display Select List for backup_dev_id, do not display and set to NULL the Select Lists for hardware_id and hardware_os_id.
Item_Type is 'HS' then display Select List for hardware_os_id, do not display and set to NULL the Select Lists backup_dev_id and hardware_id.
There are properties on elements to conditionally display it but how do we reference the values of the SQL query Updateable region? they are not given a page item name?
Also on the Tabular For Elements there is an Edit tick against a report item - however when you go to the Column Attributes there is not a property with which you can control the Edit setting.
What's the best way of implementing this requirement in APEX 3.1?
Thanks.>
Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user13515136".
When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB/version/edition/host OS
<li>Web server architecture (EPG, OHS or APEX listener/host OS)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
I have a multi-row region that displays values and allows entries in a number of fields.Provide exact details of how this has been implemented. (An example on apex.oracle.com is always a good way to do this.)
I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done? Almost anything can be done, often in multiple ways. Which are appropriate may be dependent on a particular implementation, the skills available to implement it, and the effort you're willing to expend on it. Hence it's necessary to provide full details of what you've done so far... -
Add subquery to main query in Report Builder 6i
Usually, when you add a subquery to an existing query in a report, you'll see the query in data model marked by a paper clip icon with a forward slash across it (means "Subquery Inside"). All current field names in current query (except CF and CS) will have a '1' appended after it (CF and CS fields are not affected), but in your sql, the column names stay the same. So there is an out-of-sync situation with the column names.
To fix this:
1) before change anything, back up old report somewhere else
2) copy the original query somewhere else as backup
3) open the query in Report Builder
4) wipe out the query, replace it by "select 1 from dual" to reset it and press ok.
5) replace "select 1 from dual" with your new query with an embedded subquery.
6) All field names will be without the '1' appendix.
7) check all the CS fields, the source should be reset to null. Redefine the CS fields using backed up report as reference. CF fields are not affected.
8) move the fields and restore the break orders according to backed up report.
9) Recompile whole report.
10) save report again and you're done.
Maybe you don't need this in the latest version of Report Builder, but in 6i, this is what I do.If you use aliases for your item names in your original query you avoid this problem....
eg
Select field1 item1, field2 item2 from table.....
item 1 and item2 will stay in your layout between query changes.
D -
Get a insert session value for SQL query at report
Hi friends
I created a global temp table and procedure to support web search form.
and a search result report. The procudure
gets search result from multip tables and
insert into temp table --recordsearch. I can get value from temp table by call procedure
at SQL*Plus.
However, I can not get this value by web report.
How can I get this insert session value and pass to SQL query for report?
Thanks,
Newweb
CREATE GLOBAL TEMPORARY TABLE recordsearch
(emp_id VARCHAR2(200),
ssn VARCHAR2(9),
fname VARCHAR2(200),
lname VARCHAR2(200),
m_name VARCHAR2(200)
) ON COMMIT PRESERVE ROWS;it possible that your web form does not have a persistent, dedicated connection. if you have connection pooling for example, multiple sessions will see the same instance of the GTT, so if one deletes it, then nobody sees it (or you can see others data). if the connections are not persistent, then they can disconnect between calls, deleting the GTT table.
-
How to define the PLD of a Query generator report
Hi All,
I want to define the PLD of a Query Report. Currently I am Convertning it to Excel format. But my client wants it in PLD format. so please tell me the process of defining the PLD for a Query generator Report.
Thanks & Regards
Pankaj Sharma.Hi,
When u wrote yr query at that time save yr query
Now yr query is save in "Query Manager"
Open Query Manager > select yr query
There is a button "Create Report"
Create USer Report Window is display "define yr name" and select "Base Temple"
once u save it double click and edit yr PLD....
Hope it a best way to create uer PLD
Thanks
Kevin
Maybe you are looking for
-
Credit release transfer from Delivery order to sale order
Dear Master's, Our setting for credit release from delivery order but now change requirement from our organization, they like this check from sale order and i create setting it in test server but there is a problem with me, every thing is ok, system
-
Dump While Executing ME21N, ME22N and ME23N
Hi, Am getting the below Short Dump while executing ME21N, ME22N and ME23N. Runtime Errors SYNTAX_ERROR Date and Time 08.07.2009 15:41:00 |Short text Synt
-
itunes had a upgrade and it said it failed and i have tryed to uninstall and then reinstall , i havve run a reoair program and nothing seems to work. any ideas
-
hi I am making application which is to be used to print barcodes. Now the problem is.... we are to support only a particular vendor for printing. So now how can i find out if the correct printer(barcode printer) is attached to the machine and not the
-
Several purchase requisition same day MRP
Hello, I hace materials with lot size EX Lot-for-lot order quantity. The problem is when I have 2 planned issuses the same day, When I run MRP, SAP add quantities and create only a purchase requisition. I need sap create one PR for a planned iissue,