Aggregation script is taking long time - need help on optimization
Hi All,
Currently we are working to build a BSO solution (version 11.1.2.2) for a customer where we are facing performance issue in aggregating the database. The most common activity of the solution will be to generate data on different scenario from Actual and Budget (Actual Vs Budget difference data in one scenario) and to be used for reporting purpose mainly.
We are aggregating the data to top level using AGG command for Sparse dimensions. While doing this activity, we found that it is creating a lot of page files and thereby filling up the present physical memory of the drive (to the tune of 70GB). Moreover it is taking a long time to aggregate. The no. of stored members that is present are as follows:
Dimension - Type - Stored member (Total members)
Account - Dense- 1597 (1845)
Period - Dense - 13 (19)
Year - Sparse - 11 (12)
Version - Sparse - 2 (2)
CV - Sparse- 5 (6)
Scenario - Sparse - 94 (102)
EV - Sparse - 120 (122)
FC - Sparse- 118 (121)
CP - Sparse - 1887 (2049)
M1 - Sparse - 4873 (4874)
Entity - Sparse - 12020 (32349) - Includes two alternate hierarchies for rolling up the data
The other properties are as follows:
Index Cache - 152000
Data File Cache - 32768
Data cache - 153600
ACR = 0.65
We are using Buffered I/O
The level 0 datafile is about 3 GB.( 2 year budget and 1 year 2 months Actuals data)
Customer is going to use SmartView to retrieve the data and having Planning Plus License only. So could not go for an ASO solution. We could not reduce the members of huge Sparse dimensions M1 and CP as well. To improve the data retrieval time, we had to make upper level members as stored which resolved data retrieval issue
I am seeking for help on the following:
1. How can we optimize the time taken? Currently each dimension is taking about an hour to aggregate. Calc Dim is taking even longer time. Hence opted for AGG
2. Will change of dense and sparse setting help our cause? ACR is ona lower side. Please note that most calculations are either on Period dimensions or FC. There is no such calculation on Account dimension
3. Will change of a few non-level 0 members from store to dynamic-calc help? Will this slow down calculations in the cube?
4. What should be the best performance order for this cube?
Appreciate your help in these regard,
Regards,
Sukhamoy
Please provide following information
1) Block size and other statistic
2) Aggreagation script
>>Index Cache - 152000
>>Data File Cache - 32768
>>Data cache - 153600
Try this settings
Index Cache - 1120000
Data cache - 3153600
Similar Messages
-
Script is taking long time to finish...Need Optimization Suggestion.
Hi All:
I have written below script and this script is successfully executing and deriving the correct results. But this script is taking 4 hours to complete, can you please suggest on how to improve its performance. The requirement is to run this script is less than an hour.
Any suggestion will be of great help for me . Thanks, UB
SET UPDATECALC OFF;
SET CLEARUPDATESTATUS OFF;
SET LOCKBLOCK HIGH;
SET CALCPARALLEL 7;
SET CREATEBLOCKONEQ ON;
FIX (@RELATIVE("Calculated Amounts",0), @RELATIVE("Projects",0),@RELATIVE("Business Units",0),@RELATIVE("Geography",0),@LIST(@RELATIVE("2008",0),@RELATIVE("2009",0),@RELATIVE("2010",0)))
DATACOPY "Draft" TO "Plan Iteration-1";
FIX ("Plan Iteration-1")
CCONV "CurrentMonth"->"EUR";
ENDFIX
DATACOPY "Plan Iteration-1" TO "Plan Iteration-2";
ENDFIX
ENDFIXI am not sure if it would make a difference since SET COPYMISSINGBLOCK OFF suppresses the creation of missing blocks during copy of data from a dense dimension.
http://download.oracle.com/docs/cd/E12825_01/epm.111/esb_techref/set_copymissingblock.htm -
Following Query running more than 4 hrs. could somone please suggest me to tune this query.
SELECT fi_contract_id, a.cust_id, a.product_id, a.currency_cd,
ROUND (DECODE (SUBSTR (a.ACCOUNT, 1, 4), '4992', posted_tran_amt, 0),
2
) ftp_amt,
ROUND (DECODE (SUBSTR (a.ACCOUNT, 1, 4), '4992', posted_base_amt, 0),
2
) ftp_base_amt,
ROUND (DECODE (SUBSTR (a.ACCOUNT, 1, 4),
'4994', posted_tran_amt,
'4995', posted_tran_amt,
0
2
) col_amt,
ROUND (DECODE (SUBSTR (a.ACCOUNT, 1, 4),
'4994', posted_base_amt,
'4995', posted_base_amt,
0
2
) col_base_amt,
ROUND (DECODE (SUBSTR (a.ACCOUNT, 1, 3), '499', 0, posted_tran_amt),
2
) closing_bal,
a.ACCOUNT, a.deptid, a.business_unit,
CASE
WHEN a.ACCOUNT LIKE '499%'
THEN '990'
ELSE a.operating_unit
END operating_unit,
a.base_currency, NVL (TRIM (pf_system_code), a.SOURCE) pf_system_code,
b.setid, a.channel_id, scb_arm_code, scb_tp_product, scb_tranche_id,
CASE
WHEN pf_system_code = 'CLS'
THEN scb_bncpr_flg
ELSE NULL
END tranche_purpose,
CASE
WHEN pf_system_code = 'IMX'
AND SUBSTR (scb_bncpr_flg, 1, 1) IN ('Y', 'N')
THEN SUBSTR (scb_bncpr_flg, 1, 1)
ELSE NULL
END lc_ind,
CASE
WHEN pf_system_code = 'IMX'
AND SUBSTR (scb_bncpr_flg, 1, 1) IN ('Y', 'N')
THEN SUBSTR (scb_bncpr_flg, 2, 3)
WHEN pf_system_code = 'IMX'
AND SUBSTR (scb_bncpr_flg, 1, 1) NOT IN ('Y', 'N')
THEN SUBSTR (scb_bncpr_flg, 1, 3)
ELSE NULL
END bill_branch_id,
CASE
WHEN pf_system_code = 'IMX'
AND SUBSTR (scb_bncpr_flg, 1, 1) IN ('Y', 'N')
THEN SUBSTR (scb_bncpr_flg, 5, 1)
WHEN pf_system_code = 'IMX'
AND SUBSTR (scb_bncpr_flg, 1, 1) NOT IN ('Y', 'N')
THEN SUBSTR (scb_bncpr_flg, 4, 1)
ELSE NULL
END section_id,
CASE
WHEN pf_system_code = 'IFS'
THEN SUBSTR (scb_bncpr_flg, 1, 1)
ELSE NULL
END recourse_ind,
CASE
WHEN pf_system_code = 'IFS'
THEN SUBSTR (scb_bncpr_flg, 2, 1)
ELSE NULL
END disclosure_ind,
TO_CHAR (LAST_DAY (upload_date), 'DDMMYYYY')
FROM ps_fi_ildgr_f00 a,
(SELECT c.business_unit, c.fi_instrument_id, c.scb_arm_code,
c.scb_tp_product, c.scb_tranche_id, c.scb_bncpr_flg
FROM ps_fi_iother_r00 c, ps_scb_bus_unit b1
WHERE c.business_unit = b1.business_unit
AND b1.setid = 'PKSTN'
AND c.asof_dt =
(SELECT MAX (c1.asof_dt)
FROM ps_fi_iother_r00 c1
WHERE c.business_unit = c1.business_unit
AND c1.fi_instrument_id = c.fi_instrument_id)) c,
ps_scb_bus_unit b,
(SELECT upload_date - 15 upload_date
FROM stg_ftp_trans_bal_tb
WHERE setid = 'PKSTN' AND ROWNUM < 2),
(SELECT i.business_unit, i.fi_instrument_id, i.pf_system_code,
i.fi_contract_id
FROM ps_fi_instr_f00 i, ps_scb_bus_unit b1
WHERE i.business_unit = b1.business_unit
AND b1.setid = 'PKSTN'
AND (i.asof_dt) =
(SELECT MAX (i1.asof_dt)
FROM ps_fi_instr_f00 i1
WHERE i.business_unit = i1.business_unit
AND i1.fi_instrument_id = i.fi_instrument_id)) d
WHERE a.business_unit = b.business_unit
AND a.business_unit = c.business_unit
AND a.business_unit = d.business_unit
AND a.fi_instrument_id = c.fi_instrument_id(+)
AND a.fi_instrument_id = d.fi_instrument_id(+)
AND fiscal_year = TO_CHAR (upload_date, 'YYYY')
AND a.ACCOUNT != '191801'
AND a.pf_scenario_id LIKE '%M_'
AND accounting_period = TO_CHAR (upload_date, 'MM')
AND b.setid = 'PKSTN'
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 1 | 225 | | 14059 (2)| | | | | |
|* 1 | FILTER | | | | | | | | | | |
| 2 | PX COORDINATOR | | | | | | | | | | |
| 3 | PX SEND QC (RANDOM) | :TQ10006 | 962 | 211K| | 13578 (2)| | | Q1,06 | P->S | QC (RAND) |
|* 4 | HASH JOIN | | 962 | 211K| | 13578 (2)| | | Q1,06 | PCWP | |
| 5 | PX RECEIVE | | 977 | 190K| | 4273 (2)| | | Q1,06 | PCWP | |
| 6 | PX SEND BROADCAST | :TQ10004 | 977 | 190K| | 4273 (2)| | | Q1,04 | P->P | BROADCAST |
PLAN_TABLE_OUTPUT
|* 7 | HASH JOIN | | 977 | 190K| | 4273 (2)| | | Q1,04 | PCWP | |
| 8 | BUFFER SORT | | | | | | | | Q1,04 | PCWC | |
| 9 | PX RECEIVE | | 1 | 10 | | 2 (0)| | | Q1,04 | PCWP | |
| 10 | PX SEND BROADCAST | :TQ10000 | 1 | 10 | | 2 (0)| | | | S->P | BROADCAST |
|* 11 | TABLE ACCESS FULL | PS_SCB_BUS_UNIT | 1 | 10 | | 2 (0)| | | | | |
| 12 | TABLE ACCESS BY LOCAL INDEX ROWID| PS_FI_INSTR_F00 | 1 | 42 | | 1 (0)| | | Q1,04 | PCWC | |
| 13 | NESTED LOOPS | | 1954 | 362K| | 4271 (2)| | | Q1,04 | PCWP | |
|* 14 | HASH JOIN | | 1954 | 282K| | 3999 (2)| | | Q1,04 | PCWP | |
| 15 | BUFFER SORT | | | | | | | | Q1,04 | PCWC | |
| 16 | PX RECEIVE | | 1 | 10 | | 2 (0)| | | Q1,04 | PCWP | |
| 17 | PX SEND BROADCAST | :TQ10001 | 1 | 10 | | 2 (0)| | | | S->P | BROADCAST |
PLAN_TABLE_OUTPUT
|* 18 | TABLE ACCESS FULL | PS_SCB_BUS_UNIT | 1 | 10 | | 2 (0)| | | | | |
|* 19 | HASH JOIN | | 3907 | 526K| | 3997 (2)| | | Q1,04 | PCWP | |
| 20 | PX RECEIVE | | 54702 | 4700K| | 616 (1)| | | Q1,04 | PCWP | |
| 21 | PX SEND HASH | :TQ10003 | 54702 | 4700K| | 616 (1)| | | Q1,03 | P->P | HASH |
| 22 | PX BLOCK ITERATOR | | 54702 | 4700K| | 616 (1)| 1 | 6119 | Q1,03 | PCWC | |
|* 23 | TABLE ACCESS FULL | PS_FI_ILDGR_F00 | 54702 | 4700K| | 616 (1)| 1 | 6119 | Q1,03 | PCWP | |
| 24 | BUFFER SORT | | | | | | | | Q1,04 | PCWC | |
| 25 | PX RECEIVE | | 221K| 10M| | 3380 (3)| | | Q1,04 | PCWP | |
| 26 | PX SEND HASH | :TQ10002 | 221K| 10M| | 3380 (3)| | | | S->P | HASH |
| 27 | NESTED LOOPS | | 221K| 10M| | 3380 (3)| | | | | |
| 28 | NESTED LOOPS | | 1 | 16 | | 2351 (2)| | | | | |
PLAN_TABLE_OUTPUT
| 29 | VIEW | | 1 | 6 | | 2349 (2)| | | | | |
|* 30 | COUNT STOPKEY | | | | | | | | | | |
| 31 | PARTITION LIST SINGLE | | 661K| 7755K| | 2349 (2)| KEY | KEY | | | |
| 32 | TABLE ACCESS FULL | STG_FTP_TRANS_BAL_TB | 661K| 7755K| | 2349 (2)| 2 | 2 | | | |
|* 33 | TABLE ACCESS FULL | PS_SCB_BUS_UNIT | 1 | 10 | | 2 (0)| | | | | |
| 34 | PARTITION LIST ITERATOR | | 442K| 14M| | 1029 (3)| KEY | KEY | | | |
|* 35 | TABLE ACCESS FULL | PS_FI_IOTHER_R00 | 442K| 14M| | 1029 (3)| KEY | KEY | | | |
| 36 | PARTITION LIST ITERATOR | | 1 | | | 1 (0)| KEY | KEY | Q1,04 | PCWP | |
|* 37 | INDEX RANGE SCAN | PS_FI_INSTR_F00 | 1 | | | 1 (0)| KEY | KEY | Q1,04 | PCWP | |
| 38 | VIEW | VW_SQ_1 | 5220K| 124M| | 9296 (1)| | | Q1,06 | PCWP | |
| 39 | SORT GROUP BY | | 5220K| 169M| 479M| 9296 (1)| | | Q1,06 | PCWP | |
PLAN_TABLE_OUTPUT
| 40 | PX RECEIVE | | 5220K| 169M| | 9220 (1)| | | Q1,06 | PCWP | |
| 41 | PX SEND HASH | :TQ10005 | 5220K| 169M| | 9220 (1)| | | Q1,05 | P->P | HASH |
| 42 | PX BLOCK ITERATOR | | 5220K| 169M| | 9220 (1)| 1 | 7 | Q1,05 | PCWC | |
| 43 | TABLE ACCESS FULL | PS_FI_INSTR_F00 | 5220K| 169M| | 9220 (1)| 1 | 7 | Q1,05 | PCWP | |
| 44 | SORT AGGREGATE | | 1 | 20 | | | | | | | |
| 45 | PARTITION LIST SINGLE | | 1 | 20 | | 1 (0)| KEY | KEY | | | |
|* 46 | INDEX RANGE SCAN | PS_FI_IOTHER_R00 | 1 | 20 | | 1 (0)| KEY | KEY | | | |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
1 - filter("C"."ASOF_DT"= (SELECT /*+ */ MAX("C1"."ASOF_DT") FROM "PS_FI_IOTHER_R00" "C1" WHERE "C1"."FI_INSTRUMENT_ID"=:B1 AND
"C1"."BUSINESS_UNIT"=:B2))
4 - access("I"."ASOF_DT"="VW_COL_1" AND "I"."BUSINESS_UNIT"="BUSINESS_UNIT" AND "FI_INSTRUMENT_ID"="I"."FI_INSTRUMENT_ID")
7 - access("I"."BUSINESS_UNIT"="B1"."BUSINESS_UNIT")
11 - filter("B1"."SETID"='PKSTN')
14 - access("A"."BUSINESS_UNIT"="B"."BUSINESS_UNIT")
18 - filter("B"."SETID"='PKSTN')
19 - access("A"."BUSINESS_UNIT"="C"."BUSINESS_UNIT" AND "A"."FI_INSTRUMENT_ID"="C"."FI_INSTRUMENT_ID" AND
"FISCAL_YEAR"=TO_NUMBER(TO_CHAR("UPLOAD_DATE",'YYYY')) AND "ACCOUNTING_PERIOD"=TO_NUMBER(TO_CHAR("UPLOAD_DATE",'MM')))
23 - filter("A"."PF_SCENARIO_ID" LIKE '%M_' AND "A"."ACCOUNT"<>'191801')
PLAN_TABLE_OUTPUT
30 - filter(ROWNUM<2)
33 - filter("B1"."SETID"='PKSTN')
35 - filter("C"."BUSINESS_UNIT"="B1"."BUSINESS_UNIT")
37 - access("A"."BUSINESS_UNIT"="I"."BUSINESS_UNIT" AND "A"."FI_INSTRUMENT_ID"="I"."FI_INSTRUMENT_ID")
46 - access("C1"."BUSINESS_UNIT"=:B1 AND "C1"."FI_INSTRUMENT_ID"=:B2)
Note
- 'PLAN_TABLE' is old version
75 rows selected.[email protected] wrote:
Following Query running more than 4 hrs. could somone please suggest me to tune this query.1. You can try to avoid self-joins or FILTER operations in the C and D inline views if you change below queries to use analytic functions instead:
(SELECT c.business_unit, c.fi_instrument_id, c.scb_arm_code,
c.scb_tp_product, c.scb_tranche_id, c.scb_bncpr_flg
FROM ps_fi_iother_r00 c, ps_scb_bus_unit b1
WHERE c.business_unit = b1.business_unit
AND b1.setid = 'PKSTN'
AND c.asof_dt =
(SELECT MAX (c1.asof_dt)
FROM ps_fi_iother_r00 c1
WHERE c.business_unit = c1.business_unit
AND c1.fi_instrument_id = c.fi_instrument_id)) c,
(SELECT upload_date - 15 upload_date
FROM stg_ftp_trans_bal_tb
WHERE setid = 'PKSTN' AND ROWNUM < 2),
(SELECT i.business_unit, i.fi_instrument_id, i.pf_system_code,
i.fi_contract_id
FROM ps_fi_instr_f00 i, ps_scb_bus_unit b1
WHERE i.business_unit = b1.business_unit
AND b1.setid = 'PKSTN'
AND (i.asof_dt) =
(SELECT MAX (i1.asof_dt)
FROM ps_fi_instr_f00 i1
WHERE i.business_unit = i1.business_unit
AND i1.fi_instrument_id = i.fi_instrument_id)) d
...Try to use something like this instead:
(select * from
(SELECT c.business_unit, c.fi_instrument_id, c.scb_arm_code,
c.scb_tp_product, c.scb_tranche_id, c.scb_bncpr_flg,
rank() over (order by c.asof_dt desc partition by c.business_unit, c.fi_instrument_id) rnk
FROM ps_fi_iother_r00 c, ps_scb_bus_unit b1
WHERE c.business_unit = b1.business_unit
AND b1.setid = 'PKSTN')
where rnk = 1) c,
...2. This piece seems to be questionable since it seems to pick the "UPLOAD_DATE" from an arbitrary row where SETID = 'PKSTN'. I assume that the UPLOAD_DATE is then the same for all these rows, otherwise this would potentially return a different UPLOAD_DATE for each execution of the query. Still it's a questionable approach and seems to be de-normalized data.
(SELECT upload_date - 15 upload_date
FROM stg_ftp_trans_bal_tb
WHERE setid = 'PKSTN' AND ROWNUM < 2),3. Your execution plan contains some parts that are questionable and might lead to inappropriate work performed by the database if the estimates of optimizer are wrong:
a. Are you sure that the filter predicate "SETID"='PKSTN' on PS_SCB_BUS_UNIT returns only a single row? If not, below NESTED LOOP operation could scan the PS_FI_IOTHER_R00 table more than once making this rather inefficient
| 27 | NESTED LOOPS | | 221K| 10M| | 3380 (3)| | | | | |
| 28 | NESTED LOOPS | | 1 | 16 | | 2351 (2)| | | | | |
| 29 | VIEW | | 1 | 6 | | 2349 (2)| | | | | |
|* 30 | COUNT STOPKEY | | | | | | | | | | |
| 31 | PARTITION LIST SINGLE | | 661K| 7755K| | 2349 (2)| KEY | KEY | | | |
| 32 | TABLE ACCESS FULL | STG_FTP_TRANS_BAL_TB | 661K| 7755K| | 2349 (2)| 2 | 2 | | | |
|* 33 | TABLE ACCESS FULL | PS_SCB_BUS_UNIT | 1 | 10 | | 2 (0)| | | | | |
| 34 | PARTITION LIST ITERATOR | | 442K| 14M| | 1029 (3)| KEY | KEY | | | |
|* 35 | TABLE ACCESS FULL | PS_FI_IOTHER_R00 | 442K| 14M| | 1029 (3)| KEY | KEY | | | |b. The optimizer assumes that below join returns only 3907 rows out of the 54k and 221k source sets. This could be wrong, because the join expression contains multiple function calls and an implicit TO_NUMBER conversion you haven't mentioned in your SQL which is bad practice in general:
19 - access("A"."BUSINESS_UNIT"="C"."BUSINESS_UNIT" AND "A"."FI_INSTRUMENT_ID"="C"."FI_INSTRUMENT_ID" AND
"FISCAL_YEAR"=TO_NUMBER(TO_CHAR("UPLOAD_DATE",'YYYY')) AND "ACCOUNTING_PERIOD"=TO_NUMBER(TO_CHAR("UPLOAD_DATE",'MM')))The conversion functions might hide from the optimizer that the join returns many more rows than estimated, because the optimizer uses default selectivities or guesses for function expressions. If you can't fix the data model to use appropriate join expressions you could try to create function based indexes on the expressions TO_NUMBER(TO_CHAR("UPLOAD_DATE",'YYYY')) and TO_NUMBER(TO_CHAR("UPLOAD_DATE",'MM')) and gather statistics on the corresponding hidden columns (method_opt parameter of DBMS_STATS.GATHER_TABLE_STATS call set to "FOR ALL HIDDEN COLUMNS"). If you're already on 11g you can achieve the same by using virtual columns.
|* 19 | HASH JOIN | | 3907 | 526K| | 3997 (2)| | | Q1,04 | PCWP | |
| 20 | PX RECEIVE | | 54702 | 4700K| | 616 (1)| | | Q1,04 | PCWP | |
| 21 | PX SEND HASH | :TQ10003 | 54702 | 4700K| | 616 (1)| | | Q1,03 | P->P | HASH |
| 22 | PX BLOCK ITERATOR | | 54702 | 4700K| | 616 (1)| 1 | 6119 | Q1,03 | PCWC | |
|* 23 | TABLE ACCESS FULL | PS_FI_ILDGR_F00 | 54702 | 4700K| | 616 (1)| 1 | 6119 | Q1,03 | PCWP | |
| 24 | BUFFER SORT | | | | | | | | Q1,04 | PCWC | |
| 25 | PX RECEIVE | | 221K| 10M| | 3380 (3)| | | Q1,04 | PCWP | |
| 26 | PX SEND HASH | :TQ10002 | 221K| 10M| | 3380 (3)| | | | S->P | HASH |
| 27 | NESTED LOOPS | | 221K| 10M| | 3380 (3)| | | | | |
| 28 | NESTED LOOPS | | 1 | 16 | | 2351 (2)| | | | | |
| 29 | VIEW | | 1 | 6 | | 2349 (2)| | | | | |
|* 30 | COUNT STOPKEY | | | | | | | | | | |
| 31 | PARTITION LIST SINGLE | | 661K| 7755K| | 2349 (2)| KEY | KEY | | | |
| 32 | TABLE ACCESS FULL | STG_FTP_TRANS_BAL_TB | 661K| 7755K| | 2349 (2)| 2 | 2 | | | |
|* 33 | TABLE ACCESS FULL | PS_SCB_BUS_UNIT | 1 | 10 | | 2 (0)| | | | | |
| 34 | PARTITION LIST ITERATOR | | 442K| 14M| | 1029 (3)| KEY | KEY | | | |
|* 35 | TABLE ACCESS FULL | PS_FI_IOTHER_R00 | 442K| 14M| | 1029 (3)| KEY | KEY | | | |c. Due to the small number of rows estimated, mainly caused by b. above, the result of the joins is broadcasted to all parallel slaves when performing the final join. This might be quite inefficient if the result is much larger than expected.
| 6 | PX SEND BROADCAST | :TQ10004 | 977 | 190K| | 4273 (2)| | | Q1,04 | P->P | BROADCAST |Note that this join is not necessary any longer / obsolete if you introduce above analytic functions as suggested.
4. Your PLAN_TABLE does not match your Oracle version. If you're already on 10g or later, simply drop all PLAN_TABLEs in non-SYS schemas since there is already one provided as part of the data dictionary. Otherwise re-create them using $ORACLE_HOME/rdbms/admin/utlxplan.sql
Note
- 'PLAN_TABLE' is old versionIf you want to understand where the majority of the time is spent you need to trace the execution. Note that your statement introduces an increased complexity because it uses parallel execution, therefore you'll end up with multiple trace files per parallel slave and query coordinator process, which makes the analysis not that straightforward.
Please read this HOW TO: Post a SQL statement tuning request - template posting that explains how you can enable the statement trace and what you should provide if you have SQL statement tuning question and how to format it here so that the posted information is readable by others.
This accompanying blog post shows step-by-step instructions how to obtain that information.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Script is taking long time to execute
Hi:
This is the query I am executing, this takes a lot of time, how can I use temp tables to make this work fast:
There are only about 6000 records but even then taking lot of time
SET NOCOUNT ON
DECLARE @SName VARCHAR(40), @ContactNo varchar(11), @Code VARCHAR(20), @EMail VARCHAR(40),@CodeId int
DECLARE C1 CURSOR
STATIC FOR SELECT [Staff Name],[Contact No],[Code],[EMail ID] FROM AB
OPEN C1
IF @@CURSOR_ROWS > 0
FETCH NEXT FROM C1 INTO @SName,@ContactNo,@Code,@EMail
WHILE @@Fetch_status = 0
BEGIN
IF EXISTS (SELECT * FROM AddressBook WHERE
Name=@SName)
BEGIN
UPDATE AddressBook
SET MobileNo=@ContactNo,
EMailId=@EMail
WHERE Name=@SName
END
ELSE
BEGIN
INSERT INTO AddressBook
VALUES(@SName,'',@ContactNo,@EMail,'',GETDATE(),GETDATE(),'','A',8,NULL,NULL)
END
END
CLOSE C1
DEALLOCATE C1
SET NOCOUNT OFFInstead of cursor have you tried to look at MERGE command?
IF OBJECT_ID('t1') IS NOT NULL
DROP TABLE t1
GO
CREATE TABLE t1 (id INT PRIMARY KEY, name1 VARCHAR(10))
INSERT INTO t1
SELECT 1, 'name 1' UNION ALL
SELECT 2, 'name 2' UNION ALL
SELECT 3, 'name 3' UNION ALL
SELECT 4, 'name 4' UNION ALL
SELECT 5, 'name 5'
GO
DECLARE @id INT = 6, @name1 VARCHAR(10) = 'name 6'
MERGE t1
USING (SELECT @id AS id, @name1 AS name1) AS t2 ON t1.id = t2.id
WHEN MATCHED
THEN UPDATE SET t1.name1 = t2.name1
WHEN NOT MATCHED
THEN INSERT VALUES(@id, @name1 );
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Query taking long time please help
select
o.merchantid as merchantId,
o.orderid as orderId,
p.effortid as effortId,
p.attemptid as attemptId,
o.customerid as customerId,
p.contractid as contractId,
o.merchantreference as merchantReference,
o.ordertype as orderType,
o.statusid as orderstatusId,
o.amount/100 as orderAmount,
o.currencycode as ordercurrencyCode,
o.amountrefunded/100 as amountRefunded,
o.totalamountpaid/100 as totalAmountPaid,
o.totalamountrefunded/100 as totalAmountRefunded,
p.paymentreference as paymentReference,
p.statusid as statusId,
p.amount/100 as amount,
to_char(p.statusdate,
'YYYY-MM-DD HH24:MI') as statusDate,
to_char(p.receiveddate,
'YYYY-MM-DD HH24:MI') as receivedDate,
p.creditdebitindicator as creditdebitIndicator,
to_char(p.paymentdate,
'YYYY-MM-DD HH24:MI') as paymentDate,
p.paymentmethodid as paymentMethodId,
p.paymentproductid as paymentProductId,
p.currencycode as currencyCode,
p.paymentamount/100 as paymentAmount,
p.paymentcurrencycode as paymentCurrencyCode,
pe.rejectioncode as rejectionCode,
p.amountreceived/100 as amountReceived,
pe.rejectionparameters as rejectionParameters,
pp.paymentproductgroupid as paymentproductgroupId,
ps.Statuscode as statusCode,
pp.paymentproductname as paymentProductName
FROM
Opr_Order o,
opr_paymentattempt p,
opr_paymentattempt_error pe,
gpm_paymentstatus ps,
gpm_paymentproduct pp
WHERE
pe.merchantid(+) = p.merchantid
and pe.orderid(+) = p.orderid
and pe.effortid(+) = p.effortid
and pe.attemptid(+) = p.attemptid
and o.merchantid(+) = p.merchantid
and o.orderid(+) = p.orderid
AND pp.paymentproductid = p.paymentproductid
and p.paymentmethodid = ps.paymentmethodid
and p.statusid = ps.statusid
and pp.validindicator = 1
AND ROWNUM <= 1500
AND (
pp.PAYMENTPRODUCTGROUPID = 10
OR (
pp.PAYMENTPRODUCTGROUPID = 20
OR (
pp.PAYMENTPRODUCTGROUPID = 30
OR (
pp.PAYMENTPRODUCTGROUPID = 40
OR (
pp.PAYMENTPRODUCTGROUPID = 50
OR (
pp.PAYMENTPRODUCTGROUPID = 60
OR (
pp.PAYMENTPRODUCTGROUPID = 70
OR (
pp.PAYMENTPRODUCTGROUPID = 80
AND p.receiveddate BETWEEN TO_DATE(20050801000000,'yyyyMMddhh24miss') AND TO_DATE(20110810235900,'yyyyMMddhh24miss')Please follow these guidelines to submit your request for query tuning:
SQL and PL/SQL FAQ
OR
When your query takes too long ...
HOW TO: Post a SQL statement tuning request - template posting
/* Formatted on 9/13/2011 8:20:23 AM (QP5 v5.163.1008.3004) */
SELECT o.merchantid AS merchantId,
o.orderid AS orderId,
p.effortid AS effortId,
p.attemptid AS attemptId,
o.customerid AS customerId,
p.contractid AS contractId,
o.merchantreference AS merchantReference,
o.ordertype AS orderType,
o.statusid AS orderstatusId,
o.amount / 100 AS orderAmount,
o.currencycode AS ordercurrencyCode,
o.amountrefunded / 100 AS amountRefunded,
o.totalamountpaid / 100 AS totalAmountPaid,
o.totalamountrefunded / 100 AS totalAmountRefunded,
p.paymentreference AS paymentReference,
p.statusid AS statusId,
p.amount / 100 AS amount,
TO_CHAR (p.statusdate, 'YYYY-MM-DD HH24:MI') AS statusDate,
TO_CHAR (p.receiveddate, 'YYYY-MM-DD HH24:MI') AS receivedDate,
p.creditdebitindicator AS creditdebitIndicator,
TO_CHAR (p.paymentdate, 'YYYY-MM-DD HH24:MI') AS paymentDate,
p.paymentmethodid AS paymentMethodId,
p.paymentproductid AS paymentProductId,
p.currencycode AS currencyCode,
p.paymentamount / 100 AS paymentAmount,
p.paymentcurrencycode AS paymentCurrencyCode,
pe.rejectioncode AS rejectionCode,
p.amountreceived / 100 AS amountReceived,
pe.rejectionparameters AS rejectionParameters,
pp.paymentproductgroupid AS paymentproductgroupId,
ps.Statuscode AS statusCode,
pp.paymentproductname AS paymentProductName
FROM Opr_Order o,
opr_paymentattempt p,
opr_paymentattempt_error pe,
gpm_paymentstatus ps,
gpm_paymentproduct pp
WHERE p.merchantid = pe.merchantid(+)
AND p.orderid = pe.orderid(+)
AND p.effortid = pe.effortid(+)
AND p.attemptid = pe.attemptid(+)
AND p.merchantid = o.merchantid(+)
AND p.orderid = o.orderid(+)
AND p.paymentproductid = pp.paymentproductid
AND p.paymentmethodid = ps.paymentmethodid
AND p.statusid = ps.statusid
AND pp.validindicator = 1
AND ROWNUM <= 1500
AND pp.PAYMENTPRODUCTGROUPID IN ( 10, 20, 30, 40, 50, 60, 70, 80)
AND p.receiveddate BETWEEN TO_DATE (20050801000000, 'yyyyMMddhh24miss') AND TO_DATE (20110810235900, 'yyyyMMddhh24miss')Edited by: user130038 on Sep 13, 2011 5:28 AM -
Hi All,
We are working on BI 7.0. version
In the varaible pop-up screen we have two info objects.
1. Fiscal year Period
2. JOA(Joint operating aggriment)
If u press F4 for JOA, it is taking long time to execute and finally the application is getting closed.same situation is there in RSRT also.
If i enter with out JOA the query is giving the output. Here i have to restrict the query by JOA.
i have changed the JOA peroperties in query designer.
Query execution for filter value selection = Values in master data table.......
but still the situation is the same.......
Could you please suggest any solution for this.....
Thanks & Regards,
PKHi Kamal,
You can set that at the query level in the query designer for each query.
1. Select the corresponding characteristic in the query designer.
2. Goto to the "Extended tab" in the properties
3. Select the "Values in the Master data table" in the "Query execution in the filter value selection.
Also see some recomendations:
Note 748623 - Input help (F4) has a very long runtime - recommendations
Hope this helps.
CK -
------Load Dataset into Temp table---------------
SELECT
z.SYSTEMNAME
--,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name]
--else NULL
--End AS SubSystemName
, CASE
WHEN z.PROV_TAX_ID IN
(SELECT DISTINCT zxc.TIN
FROM dbo.SQS_Provider_Tracking zxc
WHERE zxc.[SubSystem Name] <> 'NULL'
THEN
(SELECT DISTINCT [Subsystem Name]
FROM dbo.SQS_Provider_Tracking zxc
WHERE z.PROV_TAX_ID = zxc.TIN)
End As SubSYSTEMNAME
,z.PROVIDERNAME
,z.STATECODE
,z.PROV_TAX_ID
,z.SRC_PAR_CD
,SUM(z.SEQUEST_AMT) Actual_Sequestered_Amt
, CASE
WHEN z.SRC_PAR_CD IN ('E','O','S','W')
THEN 'Nonpar Waiver'
--**Amendment Mailed**
--WHEN z.PROV_TAX_ID IN
When EXISTS
(SELECT DISTINCT b.PROV_TIN
FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
where not exists (select * from dbo.sqs_objector_TINs t where b.PROV_TIN = t.prov_tin))
THEN
(SELECT DISTINCT b.Mailing
FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
WHERE z.PROV_TAX_ID = b.PROV_TIN
-- --**Amendment Mailed Wave 3 and 4**
--WHEN z.PROV_TAX_ID In
When EXISTS
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz WITH (NOLOCK )
where qz.Mailing = 'Amendment Mailed (3rd Wave)'
and not exists (select * from dbo.sqs_objector_TINs t WITH (NOLOCK ) where qz.PROV_TIN = t.prov_tin))
THEN 'Amendment Mailed (3rd Wave)'
WHEN EXISTS
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz WITH (NOLOCK )
where qz.Mailing = 'Amendment Mailed (4th Wave)'
and not exists (select * from dbo.sqs_objector_TINs t WITH (NOLOCK ) where qz.PROV_TIN = t.prov_tin))
THEN 'Amendment Mailed (4th Wave)'
-- --Is Puerto Rico of Lifesynch
WHEN EXISTS
(SELECT DISTINCT a.PROV_TAX_ID
FROM PACT.dbo.SQS_NonPar_PR_LS_TINs a WITH (NOLOCK )
WHERE a.Bucket <> 'Nonpar'
THEN
(SELECT DISTINCT a.Bucket
FROM PACT.dbo.SQS_NonPar_PR_LS_TINs a WITH (NOLOCK )
WHERE a.PROV_TAX_ID = z.PROV_TAX_ID)
-- --**Top Objecting Systems**
WHEN z.SYSTEMNAME IN
('ADVENTIST HEALTH SYSTEM','ASCENSION HEALTH ALLIANCE','AULTMAN HEALTH FOUNDATION','BANNER HEALTH SYSTEM','BERT FISH MEDICAL CENTER','BETHESDA MEMORIAL HOSPITAL','BJC HEALTHCARE','BLOUNT MEMORIAL HOSPITAL','BOCA RATON REGIONAL HOSPITAL','CAROMONT HEALTH SYSTEM','CATHOLIC HEALTH INITIATIVES','CATHOLIC HEALTHCARE PARTNERS','CHRISTUS HEALTH',/*'CLEVELAND CLINIC HEALTH SYSTEM',*/'COLUMBUS REGIONAL HEALTHCARE SYSTEM','COMMUNITY HEALTH SYSTEMS, INC','COXHEALTH','HCA','HEALTH MANAGEMENT ASSOCIATES','HUNTSVILLE HOSPITAL HEALTH SYSTEM','INTEGRIS HEALTH','JUPITER MEDICAL CENTER','LEE MEMORIAL HEALTH SYSTEM','MARTIN MEMORIAL HEALTH SYSTEM','MERCY','MT SINAI MEDICAL CENTER (MIAMI)','MUNROE REGIONAL MEDICAL CENTER','NORMAN REGIONAL HEALTH SYSTEM','NORTHSIDE HEALTH SYSTEM','SHANDS HEALTHCARE','SISTERS OF MERCY - SPRINGFIELD, MO','SSM HEALTH CARE','ST LUKES HEALTH SYSTEM','SUMMA HEALTH SYSTEM','SUSQUEHANNA HEALTH SYSTEM','TBD -- TRINITY HEALTH - CATHOLIC HEALTH EAST','UNIVERSITY OF MISSOURI HEALTH SYSTEM','UNIVERSITY OF NEW MEXICO HOSPITALS','UNIVERSITY OF UTAH HEALTH CARE')
THEN 'Top Objecting Systems'
WHEN EXISTS
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Top Objector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
THEN 'Top Objecting Systems'
-- --**Other Objecting Hospitals**
WHEN EXISTS
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Objector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
THEN 'Other Objecting Hospitals'
-- --**Objecting Physicians**
WHEN EXISTS
(SELECT z.PROV_TAX_ID
FROM SQS_EDW_Source z WITH (NOLOCK)
WHERE EXISTS
(SELECT DISTINCT
obj.TIN
FROM SQS_Provider_Tracking obj WITH (NOLOCK )
WHERE obj.[Objector?] in ('Objector','Top Objector')
and z.PROV_TAX_ID = obj.TIN
and z.LCLM_RSTMT_TREND_CAT_CD not IN ('HO','HI')
THEN 'Objecting Physicians'
--****Rejecting Hospitals****
WHEN EXISTS
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN SQS_Provider_Tracking obj WITH (NOLOCK )
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Rejector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
THEN 'Rejecting Hospitals'
--****Rejecting Physciains****
WHEN EXISTS
(SELECT obj.TIN
FROM SQS_Provider_Tracking obj WITH (NOLOCK )
WHERE z.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Rejector')
and z.LCLM_RSTMT_TREND_CAT_CD NOT IN ('HO','HI')
THEN 'REjecting Physicians'
----**********ALL OBJECTORS SHOULD HAVE BEEN BUCKETED AT THIS POINT IN THE QUERY**********
-- --**Non-Objecting Hospitals**
WHEN EXISTS
(SELECT DISTINCT
h.PROV_TAX_ID
FROM
#HIHO_Records h WITH (NOLOCK )
WHERE
(z.PROV_TAX_ID = h.PROV_TAX_ID)
OR h.SMG_ID IS NOT NULL
)and z.LCLM_RSTMT_TREND_CAT_CD IN ('HO','HI')
THEN 'Non-Objecting Hospitals'
-- **Outstanding Contracts for Review**
WHEN EXISTS
(SELECT qz.PROV_TIN
FROM
[PACT].[HUMAD\ARS3766].[SQS_Mailed_TINs] qz WITH (NOLOCK )
where qz.Mailing = 'Non-Objecting Bilateral Physicians'
AND z.PROV_TAX_ID = qz.PROV_TIN)
Then 'Non-Objecting Bilateral Physicians'
When EXISTS
(select
p.prov_tax_id
from dbo.SQS_CoC_Potential_Mail_List p WITH (NOLOCK )
where p.amendmentrights <> 'Unilateral'
AND z.prov_tax_id = p.prov_tax_id)
THEN 'Non-Objecting Bilateral Physicians'
WHEN EXISTS
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz WITH (NOLOCK )
where qz.Mailing = 'More Research Needed'
AND qz.PROV_TIN = z.PROV_TAX_ID)
THEN 'More Research Needed'
WHEN EXISTS (SELECT qz.PROV_TIN FROM [SQS_Mailed_TINs] qz WITH (NOLOCK ) where qz.Mailing = 'Objector' AND qz.PROV_TIN = z.PROV_TAX_ID)
THEN 'ERROR'
else 'Market Review/Preparing to Mail'
END AS [Updated Bucket]
,COALESCE(q.INDdesc, f.IND_desc) AS INDdesc
,f.Time_Period_for_Dispute
,f.Renew_Term_Ind
,f.Renewal_Date
,z.SMG_ID
,'' AS OrderedRank
INTO SQS_Bucketed_Details_SMG_on_SMGXXX
From #SQS_EDW_SOURCE_WithSMG z
left join #F f ON f.PROV_TAX_ID = z.PROV_TAX_ID
AND z.SYSTEMNAME = f.SYSTEM_NAME
AND z.PROVIDERNAME = f.Provider
Left join #Q q ON z.PROV_TAX_ID = q.TIN
GROUP BY z.SYSTEMNAME
--,Z.[SubsystemName]
,z.PROVIDERNAME
,z.STATECODE
,z.PROV_TAX_ID
,z.SRC_PAR_CD
,q.INDdesc
,f.IND_Desc
,f.Time_Period_for_Dispute
,f.Renew_Term_Ind
,f.Renewal_Date
,z.SMG_ID
,z.LCLM_RSTMT_TREND_CAT_CD
As I am a developer I do not have the access to Sql profiler or tuning agent to optimize my query, I have used some joins over the temp table #HIHO which indeed pulling the records from table EDW_Source which has 5 million records, I also added Non clustered
indexes on prov_ID, SMG_ID and Incurred month for this table, but still it is taking longer time. Need helpHi, It needs some more tweaks but pls try this one
USE
Go
--****Create sqs_objector_TINs (Objections and Rejections)****
--Drop table .dbo.sqs_objector_TINs
select distinct a.TIN as Prov_TIN
Into #sqs_objector_TINs
from .dbo.sqs_provider_tracking as a with (nolock)
where a.[Objector?] in ('Top Objector','Objector','Rejector')
/*********** Query for SQS_TINtoSyst***********/
--DROP TABLE .dbo.SQS_TINtoSystem
select distinct
b.SRC_PROV_ID
--,case
-- when a.SYSTEM_NAME is null
-- then
-- case
-- when a.CTRCT_GRP_NAME is null
-- then a.PROV_SMG_NAME
-- else a.CTRCT_GRP_NAME
-- end
-- else a.SYSTEM_NAME
--end as SYSTEM_NAME
,COALESCE(a.SYSTEM_NAME, a.CTRCT_GRP_NAME, a.PROV_SMG_NAME) AS SYSTEM_NAME
INTO #SQS_TINtoSystem
from
PARE.dbo.EDW_PROD_HOSPITAL_MASTER a with (nolock)
Inner Join PARE.dbo.EDW_PROD_HOSPITAL_ID_XREF b with (nolock)
on a.SMG_ID = b.SMG_ID
-- Inner Join .dbo.SQS_EDW_Source q
--on b.SRC_PROV_ID = q.PROV_TAX_ID
where b.SRC_PLATFORM_CD = 'TX'
and exists
select
SMG_ID
from PARE.dbo.EDW_PROD_HOSPITAL_ID_XREF as t1 with (nolock)
where SRC_PLATFORM_CD = 'TX'
and exists (select q.PROV_TAX_ID from .dbo.SQS_EDW_Source q with (nolock) where q.PROV_TAX_ID = b.SRC_PROV_ID)
and a.SMG_ID = t1.SMG_ID
/************** Query for SQS_Bucketed_Details_SMG*****************/
DROP TABLE .dbo.SQS_Bucketed_Details_SMG
--Create temp table
SELECT z.SYSTEMNAME
,Z.PROV_TAX_ID
,z.PROVIDERNAME
,z.STATECODE
,z.SRC_PAR_CD
,z.SEQUEST_AMT
,case when Z.LCLM_RSTMT_TREND_CAT_CD IN ('HI','HO') Then 'H' else 'P' end as Hosp_Ind
,Z.SMG_ID
INTO #SQS_EDW_SOURCE_WithSMG
FROM dbo.SQS_EDW_SOURCE_WithSMG z with (nolock)
WHERE (Z.Incurred_Mth >= convert(datetime,'01/01/2013')) and (Z.Incurred_Mth < convert(datetime, '1/1/2014'))
--between convert(datetime,'01/01/2013') and convert(datetime, '12/31/2013 23:59:59.996')
--YEAR(Z.Incurred_Mth)=2013
-- Create Temp table Q
select
x.TIN,
case when max(x.IND) = 'NYN'
then 'Standard'
when max(x.IND) = 'YNN'
then 'Express'
when max(x.IND) = 'NNY'
then 'Non_Standard' else 'Mixed'
end as INDdesc
Into #Q
FROM
(SELECT
a.tin,
MAX(a.express) + MAX(a.StandardInd) + MAX(NonstandardIND) as IND
from
(select r.TIN,
case when MAX(r.Express) like 'Y%' then 'Y' else 'N' end As Express,
case when MAX(r.Standard) = 'Y' then 'Y' else 'N' end As StandardInd,
case when MAX(r.[Non-Standard]) = 'Y' then 'Y' else 'N' end AS NonstandardIND
FROM DBO.SQS_Objectors_01032014 r with (nolock)
GROUP BY r.TIN) a
group by a.TIN) x
group by x.TIN
--Create Temp table F
Select *
INTO #F
FROM(
SELECT distinct g.prov_tax_id
,g.system_name
,g.provider
,case when g.reimburse_mixed = 'Y' then 'Mixed'
when g.reimburse_express = 'Y' then 'Express'
when g.reimburse_standard = 'Y' then 'Standard'
when g.reimburse_NonStandard = 'Y' then 'NonStandard'
end as IND_Desc
,g.Time_Period_for_Dispute
,case when g.Renewal_Date = 'N' and g.Expiration_Date = 'N'
then 'Unclear'
when g.Renewal_Date = 'N' and g.Expiration_Date <> 'N'
then 'Termination'
when g.Renewal_Date <> 'N' and g.Expiration_Date = 'N'
then 'Evergreen'
when g.Renewal_Date <> 'N' and g.Expiration_Date <> 'N'
then 'Termination'
else 'Unknown'
end as 'Renew_Term_Ind'
,g.Renewal_Date
FROM
(select distinct
bb.PROV_TAX_ID1 as prov_tax_id
,aa.*
from
[dbo].[Top_600_Hospitals3] aa with (nolock)
left join pare.dbo.EDW_PROD_HOSPITAL_MASTER bb with (nolock)
on --a.CTRCT_GRP_NAME = b.CTRCT_GRP_NAME
aa.Provider = bb.PROV_SMG_NAME
-- and (a.SYSTEM_NAME = b.SMG_SYS_NAME or a.SYSTEM_NAME = b.SYSTEM_NAME)
--and a.ADDR_LINE1 = b.ADDR_LINE1
and aa.STATE_CD = bb.STATE_CD
--and a.ZIP_CD = b.ZIP_CD
and aa.City1 = bb.CITY_NAME
where aa.SYSTEM_NAME <> 'SEE ABOVE') g
where g.system_name <> 'SEE ABOVE') h
where h.ind_Desc is not null
SELECT DISTINCT z.PROV_TAX_ID
, z.SMG_ID
INTO #HIHO_Records
FROM SQS_EDW_SOURCE_WithSMG z with (nolock)
WHERE z.LCLM_RSTMT_TREND_CAT_CD IN ('HO', 'HI')
AND Z.Incurred_Mth >=convert(datetime, '1/1/2013') and Z.Incurred_Mth <convert(datetime, '1/1/2014')
--YEAR(Z.Incurred_Mth)=2013
---------------------------------Load Dataset into Temp table---------------
SELECT
z.SYSTEMNAME
--,Case when ZXC.[Subsystem Name] <> 'NULL' Then zxc.[SubSystem Name]
--else NULL
--End AS SubSystemName
, CASE
WHEN z.PROV_TAX_ID IN
(SELECT zxc.TIN
FROM dbo.SQS_Provider_Tracking zxc with (nolock)
WHERE zxc.[SubSystem Name] <> 'NULL'
THEN
(SELECT top 1 [Subsystem Name]
FROM dbo.SQS_Provider_Tracking zxc with (nolock)
WHERE z.PROV_TAX_ID = zxc.TIN)
End As SubSYSTEMNAME
,z.PROVIDERNAME
,z.STATECODE
,z.PROV_TAX_ID
,z.SRC_PAR_CD
,SUM(z.SEQUEST_AMT) Actual_Sequestered_Amt
, CASE
WHEN z.SRC_PAR_CD IN ('E','O','S','W')
THEN 'Nonpar Waiver'
-- --Is Puerto Rico of Lifesynch
WHEN z.PROV_TAX_ID IN
(SELECT a.PROV_TAX_ID
FROM .dbo.SQS_NonPar_PR_LS_TINs a with (nolock)
WHERE a.Bucket <> 'Nonpar'
THEN
(SELECT top 1 a.Bucket
FROM .dbo.SQS_NonPar_PR_LS_TINs a with (nolock)
WHERE a.PROV_TAX_ID = z.PROV_TAX_ID)
--**Amendment Mailed**
WHEN z.PROV_TAX_ID IN
(SELECT b.PROV_TIN
FROM dbo.SQS_Mailed_TINs_010614 b WITH (NOLOCK )
where not exists (select * from dbo.sqs_objector_TINs t with (nolock) where b.PROV_TIN = t.prov_tin))
and z.Hosp_Ind = 'P'
THEN
(SELECT top 1 b.Mailing
FROM dbo.SQS_Mailed_TINs_010614 b with (nolock)
WHERE z.PROV_TAX_ID = b.PROV_TIN
-- --**Amendment Mailed Wave 3-5**
WHEN z.PROV_TAX_ID In
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz
where qz.Mailing = 'Amendment Mailed (3rd Wave)'
and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
and z.Hosp_Ind = 'P'
THEN 'Amendment Mailed (3rd Wave)'
WHEN z.PROV_TAX_ID IN
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz
where qz.Mailing = 'Amendment Mailed (4th Wave)'
and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
and z.Hosp_Ind = 'P'
THEN 'Amendment Mailed (4th Wave)'
WHEN z.PROV_TAX_ID IN
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz
where qz.Mailing = 'Amendment Mailed (5th Wave)'
and not exists (select * from dbo.sqs_objector_TINs t with (nolock) where qz.PROV_TIN = t.prov_tin))
and z.Hosp_Ind = 'P'
THEN 'Amendment Mailed (5th Wave)'
-- --**Top Objecting Systems**
WHEN z.SYSTEMNAME IN
('ADVENTIST HEALTH SYSTEM','ASCENSION HEALTH ALLIANCE','AULTMAN HEALTH FOUNDATION')
THEN 'Top Objecting Systems'
WHEN z.PROV_TAX_ID IN
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Top Objector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.Hosp_Ind = 'H'
THEN 'Top Objecting Systems'
-- --**Other Objecting Hospitals**
WHEN (z.PROV_TAX_ID IN
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Objector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.Hosp_Ind = 'H')
THEN 'Other Objecting Hospitals'
-- --**Objecting Physicians**
WHEN (z.PROV_TAX_ID IN
(SELECT
obj.TIN
FROM .dbo.SQS_Provider_Tracking obj with (nolock)
WHERE obj.[Objector?] in ('Objector','Top Objector')
and z.PROV_TAX_ID = obj.TIN
and z.Hosp_Ind = 'P')
THEN 'Objecting Physicians'
--****Rejecting Hospitals****
WHEN (z.PROV_TAX_ID IN
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
INNER JOIN .dbo.SQS_Provider_Tracking obj with (nolock)
ON h.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Rejector'
WHERE z.PROV_TAX_ID = h.PROV_TAX_ID
OR h.SMG_ID IS NOT NULL
)and z.Hosp_Ind = 'H')
THEN 'Rejecting Hospitals'
--****Rejecting Physciains****
WHEN
(z.PROV_TAX_ID IN
(SELECT
obj.TIN
FROM .dbo.SQS_Provider_Tracking obj with (nolock)
WHERE z.PROV_TAX_ID = obj.TIN
AND obj.[Objector?] = 'Rejector')
and z.Hosp_Ind = 'P')
THEN 'REjecting Physicians'
----**********ALL OBJECTORS SHOULD HAVE BEEN BUCKETED AT THIS POINT IN THE QUERY**********
-- --**Non-Objecting Hospitals**
WHEN z.PROV_TAX_ID IN
(SELECT
h.PROV_TAX_ID
FROM
#HIHO_Records h
WHERE
(z.PROV_TAX_ID = h.PROV_TAX_ID)
OR h.SMG_ID IS NOT NULL)
and z.Hosp_Ind = 'H'
THEN 'Non-Objecting Hospitals'
-- **Outstanding Contracts for Review**
WHEN z.PROV_TAX_ID IN
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz with (nolock)
where qz.Mailing = 'Non-Objecting Bilateral Physicians'
AND z.PROV_TAX_ID = qz.PROV_TIN)
Then 'Non-Objecting Bilateral Physicians'
When z.prov_tax_id in
(select
p.prov_tax_id
from dbo.SQS_CoC_Potential_Mail_List p with (nolock)
where p.amendmentrights <> 'Unilateral'
AND z.prov_tax_id = p.prov_tax_id)
THEN 'Non-Objecting Bilateral Physicians'
WHEN z.PROV_TAX_ID IN
(SELECT
qz.PROV_TIN
FROM
[SQS_Mailed_TINs] qz
where qz.Mailing = 'More Research Needed'
AND qz.PROV_TIN = z.PROV_TAX_ID)
THEN 'More Research Needed'
WHEN z.PROV_TAX_ID IN (SELECT qz.PROV_TIN FROM [SQS_Mailed_TINs] qz with (nolock) where qz.Mailing = 'Objector' AND qz.PROV_TIN = z.PROV_TAX_ID)
THEN 'ERROR'
else 'Market Review/Preparing to Mail'
END AS [Updated Bucket]
,COALESCE(q.INDdesc, f.IND_desc) AS INDdesc
,f.Time_Period_for_Dispute
,f.Renew_Term_Ind
,f.Renewal_Date
,z.SMG_ID
,'' AS OrderedRank
INTO dbo.SQS_Bucketed_Details_SMG with (nolock)
From #SQS_EDW_SOURCE_WithSMG z
left join #F f ON f.PROV_TAX_ID = z.PROV_TAX_ID
AND z.SYSTEMNAME = f.SYSTEM_NAME
AND z.PROVIDERNAME = f.Provider
Left join #Q q ON z.PROV_TAX_ID = q.TIN
GROUP BY z.SYSTEMNAME
--,Z.[SubsystemName]
,z.PROVIDERNAME
,z.STATECODE
,z.PROV_TAX_ID
,z.SRC_PAR_CD
,q.INDdesc
,f.IND_Desc
,f.Time_Period_for_Dispute
,f.Renew_Term_Ind
,f.Renewal_Date
,z.SMG_ID
,z.Hosp_Ind
/************************** Drop temp tables*********************/
--DROP TABLE #SQS_EDW_SOURCE_WithSMG
--DROP TABLE #Q
--DROP TABLE #F
--DROP TABLE #HIHO_Records
--DROP TABLE #SQS_TINtoSystem
--DROP TABLE #SQS_EDW_SOURCE_WithSMG
--DROP TABLE #sqs_objector_TINs -
In my macbook pro 5,2 snow leopard (10.6.8), Finder taking long time to load contents of any directory. Please help?
I have already tried to spotlight re-indexing but it did not help. I am hardly able to work on it, almost for each directory I browse its keeps on spinning for 1min.Download iTunes from Apple's web site and install it. Don't use Software Update.
-
The ODS activation is taking long time
Hi,
We are on SAP NetWeaver BI 701 (Support Package 5).
We create a Z ODS, it will contain a lot of data (180.000.000 month-end) and we want to generate specific reports about it.
The activation is taking long time, I assume is because we checked the flag "SIDs Generation upon Activation". I am confused about this check. I really need it? is this check the only problem.
Thanks for you help.
VictoriaHi Victoria:
If your Z DSO is used only for staging purposes (you don't have queries based on this DSO and you send the data to another DSO or to an InfoCube) then you don't need to check the "SIDs Generation Upon Activation" box.
Even more, to achieve better performance during data loads in this scenario, you might consider using a Write Optimized DSO instead of a Standard DSO, but if you decide to take this alternative don't forget to select the "Do Not check Uniqueness of Data" box if you need to write several records with the same Semantic Key.
Regards,
Francisco Milán. -
VB Macro in Bex Analyser is taking long time to complete execution
Hi Experts,
In a FI query , we have a VB macro which update the excel sheets by taking values from the previous excel sheets .
The issue is its taking long time for query execution and if we are keep on pressing 'ENTER' button . The query is running very fastly and is giving the results ,but its not a correct way to do.
Its a critical issue in Production and can anyone help me to resolve the issue.
Regards,
AnjuHi Anju,
I need to create a VB macro in one of my query but i not familiar how i can plug the VB code into the query.
Please can you give me some basic procedure on how to do that?
What i need to do exactly is to bring a KF from a query into another query. Not sure if this is possible using VB.
Let me know.
Thanks.
Cesar -
Taking long time to execute views
Hi All,
my query is taking long time to execute(i am using standard views in my query)
XLA_INV_AEL_GL_V , XLA_WIP_AEL_GL_V -----these standard views itself taking long time to execute ,but i need the info from this views
WHERE gjh.je_batch_id = gjb.je_batch_id AND
gjh.je_header_id = gjl.je_header_id AND
gjh.je_header_id = xlawip.je_header_id AND
gjl.je_header_id = xlawip.je_header_id AND
gjl.je_line_num = xlawip.je_line_num AND
gcc.code_combination_id = gjl.code_combination_id AND
gjl.code_combination_id = xlawip.code_combination_id AND
gjb.set_of_books_id = xlawip.set_of_books_id AND
gjh.je_source = 'Inventory' AND
gjh.je_category = 'WIP' AND
gp.period_set_name = 'Accounting' AND
gp.period_name = gjl.period_name AND
gp.period_name = gjh.period_name AND
gp.start_date +1 between to_date(startdate,'DD-MON-YY') AND
to_date(enddate,'DD-MON-YY') AND
gjh.status =nvl(lstatus,gjh.status)
Could any one help me to execute it fast?
Thanks
Madhu[url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]When your query takes too long...
-
Hi Experts,
Select query is taking long time execution.
*- Get the Goods receipts mainly selected per period (=> MKPF secondary
SELECT mseg~ebeln mseg~ebelp mseg~werks
ekko~bukrs ekko~lifnr ekko~zterm ekko~ekorg ekko~ekgrp
ekko~inco1 ekko~exnum
lfa1~name1 lfa1~land1 lfa1~ktokk lfa1~stceg
mkpf~mblnr mkpf~mjahr mseg~zeile mkpf~bldat mkpf~budat
mseg~bwart
*Start of changes for CIP 6203752 by PGOX02
mseg~smbln
*End of changes for CIP 6203752 by PGOX02
ekpo~matnr ekpo~txz01 ekpo~menge ekpo~meins
ekbe~menge ekbe~dmbtr ekbe~wrbtr ekbe~waers
ekpo~lgort ekpo~matkl ekpo~webaz ekpo~konnr ekpo~ktpnr
ekpo~plifz ekpo~bstae
INTO corresponding fields of TABLE it_temp
*--Begin of modification
* FROM mkpf JOIN mseg ON mseg~mblnr EQ mkpf~mblnr
FROM mkpf INNER JOIN mseg ON mseg~mandt EQ mkpf~mandt
and mseg~mblnr EQ mkpf~mblnr
*--End of modification
AND mseg~mjahr EQ mkpf~mjahr
JOIN ekbe ON ekbe~ebeln EQ mseg~ebeln
AND ekbe~ebelp EQ mseg~ebelp
AND ekbe~zekkn EQ '00'
AND ekbe~vgabe EQ '1'
AND ekbe~gjahr EQ mseg~mjahr
AND ekbe~belnr EQ mseg~mblnr
AND ekbe~buzei EQ mseg~zeile
JOIN ekpo ON ekpo~ebeln EQ ekbe~ebeln
AND ekpo~ebelp EQ ekbe~ebelp
JOIN ekko ON ekko~ebeln EQ ekpo~ebeln
JOIN lfa1 ON lfa1~lifnr EQ ekko~lifnr
WHERE mkpf~budat IN so_budat
AND mkpf~bldat IN so_bldat
AND mkpf~vgart EQ 'WE'
AND mseg~bwart IN so_bwart
AND mseg~matnr IN so_matnr
AND mseg~werks IN so_werks
AND mseg~lifnr IN so_lifnr
AND mseg~ebeln IN so_ebeln
AND ekko~ekgrp IN so_ekgrp
AND ekko~bukrs IN so_bukrs
AND ekpo~matkl IN so_matkl
AND ekko~bstyp IN so_bstyp
AND ekpo~loekz EQ space
AND ekpo~plifz IN so_plifz.
in st05 it is showing MKPF is taking more time. Need ur sugesstions need ur help
Moderator message - Please use code tags to format your code
Edited by: Rob Burbank on Feb 5, 2010 9:21 AMHi,
your result set is quite big.
20296 records in 283,5 seconds (13,9 ms per record) might not be optimal
but definatelly the big result set will take time to execute, since you are reading data from 6 tables:
SELECT
FROM mkpf
JOIN mseg ON u2026
JOIN ekbe ON u2026
JOIN ekpo ON u2026
JOIN ekko ON u2026
JOIN lfa1 ON u2026
what run time do you expect?
In case we would be able to get one record in 5ms it will still run more than 100 seconds.
Generally: Limit the result set as far as possible (with where conditions), select only the columns that are really needed.
Geneal nested loop join optimization:
check if the optimizer chooses the table that has the smallest result set (take all where conditions for each table
and use SE16 to count the result sets, the smallest one should be the start for the nested loop join.
For the starting table the selective where condition fields (those the limit the result set significantly for that table) should be indexed.
For other tables the join condition (and maybe additional selecitve where conditions for this table) should be indexed. but most likely you will join to the tables using the primary key which is indexed... .
Kind regards,
Hermann -
hi Team,
We are running SLD on separate hardware with Windows 2003. But since couple of months we been observing that 'full GC taking longer time' then it used to be. So wondering what are the possible parameters, configuration items that i need to look back to find tune this issue.
any good reference docs related to find tuning the GC is much appriciated.
Thanks
SekharHi ,
Hope this might help.
http://www.ibm.com/developerworks/library/i-gctroub/
http://my.safaribooksonline.com/0596003773/javapt2-CHP-3-SECT-4#X2ludGVybmFsX1NlY3Rpb25Db250ZW50P3htbGlkPTA1OTYwMDM3NzMvamF2YXB0Mi1DSFAtMy1TRUNULTE=
http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
Also check out the pdfs
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/7fdca26e-0601-0010-369d-b3fc87d3a2d9
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/22baa590-0201-0010-26a3-f1cfa2469973
Rgds
joel -
SSRS Reports taking long time to load
Hello,
Problem : SSRS Reports taking long time to load
My System environment : Visual Studio 2008 SP1 and SQL Server 2008 R2
Production Environment : Visual Studio 2008 SP1 and SQL Server 2008 R2
I have created a Parameterized report (6 parameters), it will fetch data from 1 table. table has 1 year and 6 months data, I am selecting parameters for only 1 month (about 2500 records). It is taking almost 2 minutes and 30 seconds
to load the report.
This report running efficiently in my system (report load takes only 5 to 6 seconds) but in
production it is taking 2 minutes 30 seconds.
I have checked the Execution log from production so I found the timing for
Data retrieval (approx~) Processing (approx~) Rendering (approx~)
10 second 15 sec
2 mins and 5 sec.
But Confusing point is that , if I run the same report at different time overall output time is same (approx) 2 min 30 sec but
Data retrieval (approx~) Processing (approx~) Rendering (approx~)
more than 1 min 15 sec
more than 1 min
so 1 question why timings are different ?
My doubts are
1) If query(procedure to retrieve the data) is the problem then it should take more time always,
2) If Report structure is problem then rendering will also take same time (long time)
for this (2nd point) I checked on blog that Rendering depends on environment structure e.g. Network bandwidth, RAM, CPU Usage , Number of users accessing same report at a time.
So I did testing of report when no other user working on any report But failed (same result output is 2 min 30 sec)
From network team I got the result is that there is no issue or overload in CPU usage or RAM also No issue in Network bandwidth.
Production Database Server and Report server are different (but in same network).
I checked that database server the SQL Server is using almost Full RAM (23 GB out of 24 GB)
I tried to allocate the memory to less amount up to 2GB (Trial solution I got from Blogs) but this on also failed.
one hint I got from colleague that , change the allocated memory setting from static memory to dynamic to SQL Server
(I guess above point is the same) I could not find that option Static and Dynamic memory setting.
I did below steps
Connected to SQL Server Instance
Right click on Instance go to properties, Go to Memory Tab
I found three options 1) Server Memory 2) Other memory 3) Section for "Configured values and Running values"
Then I tried to reduce Maximum Server memory up to 2 GB (As mentioned above)
All trials failed, this issue I could not find the roots for this issue.
Can anyone please help (it's bit urgent).Hi UdayKGR,
According to your description, your report takes too long to load on your production environment. Right?
In this scenario, since the report runs quickly in developing environment, we initially think it supposed to be the issue on data retrieval. However, based on the information in execution log, it takes longest time on rendering part. So we suggest you optimize
the report itself to reduce the time for rendering. Please refer to the link below:
My report takes too long to render
Here is another article about overall performance optimization for Reporting Services:
Reporting Services Performance and Optimization
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Simple query is taking long time
Hi Experts,
The below query is taking long time.
[code]SELECT FS.*
FROM ORL.FAX_STAGE FS
INNER JOIN
ORL.FAX_SOURCE FSRC
INNER JOIN
GLOBAL_BU_MAPPING GBM
ON GBM.BU_ID = FSRC.BUID
ON UPPER (FSRC.FAX_NUMBER) = UPPER (FS.DESTINATION)
WHERE FSRC.IS_DELETED = 'N'
AND GBM.BU_ID IS NOT NULL
AND UPPER (FS.FAX_STATUS) ='COMPLETED';[/code]
this query is returning 1645457 records.
[code]PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 625K| 341M| 45113 (1)|
| 1 | HASH JOIN | | 625K| 341M| 45113 (1)|
| 2 | NESTED LOOPS | | 611 | 14664 | 22 (0)|
| 3 | TABLE ACCESS FULL| FAX_SOURCE | 2290 | 48090 | 22 (0)|
| 4 | INDEX RANGE SCAN | GLOBAL_BU_MAPPING_BUID | 1 | 3 | 0 (0)|
| 5 | TABLE ACCESS FULL | FAX_STAGE | 2324K| 1214M| 45076 (1)|
PLAN_TABLE_OUTPUT
Note
- 'PLAN_TABLE' is old version
15 rows selected.[/code]
The distinct number of records in each table.
[code]SELECT FAX_STATUS,count(*)
FROM fax_STAGE
GROUP BY FAX_STATUS;
FAX_STATUS COUNT(*)
BROKEN 10
Broken - New 9
Completed 2324493
New 20
SELECT is_deleted,COUNT(*)
FROM FAX_SOURCE
GROUP BY IS_DELETED;
IS_DELETED COUNT(*)
N 2290
Y 78[/code]
Total number of records in each table.
[code]SELECT COUNT(*) FROM ORL.FAX_SOURCE FSRC-- 2368
SELECT COUNT(*) FROM ORL.FAX_STAGE--2324532
SELECT COUNT(*) FROM APPS_GLOBAL.GLOBAL_BU_MAPPING--9
[/code]
To improve the performance of this query I have created the following indexes.
[code]Functional based index on UPPER (FSRC.FAX_NUMBER) ,UPPER (FS.DESTINATION) and UPPER (FS.FAX_STATUS).
Bitmap index on FSRC.IS_DELETED.
Normal Index on GBM.BU_ID and FSRC.BUID.
[/code]
But still the performance is bad for this query.
What can I do apart from this to improve the performance of this query.
Please help me .
Thanks in advance.<I have created the following indexes.
CREATE INDEX ORL.IDX_DESTINATION_RAM ON ORL.FAX_STAGE(UPPER("DESTINATION"))
CREATE INDEX ORL.IDX_FAX_STATUS_RAM ON ORL.FAX_STAGE(LOWER("FAX_STATUS"))
CREATE INDEX ORL.IDX_UPPER_FAX_STATUS_RAM ON ORL.FAX_STAGE(UPPER("FAX_STATUS"))
CREATE INDEX ORL.IDX_BUID_RAM ON ORL.FAX_SOURCE(BUID)
CREATE INDEX ORL.IDX_FAX_NUMBER_RAM ON ORL.FAX_SOURCE(UPPER("FAX_NUMBER"))
CREATE BITMAP INDEX ORL.IDX_IS_DELETED_RAM ON ORL.FAX_SOURCE(IS_DELETED)
After creating the following indexes performance got improved.
But our DBA said that new BITMAP index at FAX_SOURCE table (ORL.IDX_IS_DELETED_RAM) can cause locks
on multiple rows if IS_DELETED column is in use. Please proceed with detailed tests.
I am sending the explain plan before creating indexes and after indexes has been created.
SELECT FS.*
FROM ORL.FAX_STAGE FS
INNER JOIN
ORL.FAX_SOURCE FSRC
INNER JOIN
GLOBAL_BU_MAPPING GBM
ON GBM.BU_ID = FSRC.BUID
ON UPPER (FSRC.FAX_NUMBER) = UPPER (FS.DESTINATION)
WHERE FSRC.IS_DELETED = 'N'
AND GBM.BU_ID IS NOT NULL
AND UPPER (FS.FAX_STATUS) =:B1;
--OLD without indexes
PLAN_TABLE_OUTPUT
Plan hash value: 3076973749
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 141K| 85M| 45130 (1)| 00:09:02 |
|* 1 | HASH JOIN | | 141K| 85M| 45130 (1)| 00:09:02 |
| 2 | NESTED LOOPS | | 611 | 18330 | 22 (0)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| FAX_SOURCE | 2290 | 59540 | 22 (0)| 00:00:01 |
|* 4 | INDEX RANGE SCAN | GLOBAL_BU_MAPPING_BUID | 1 | 4 | 0 (0)| 00:00:01 |
|* 5 | TABLE ACCESS FULL | FAX_STAGE | 23245 | 13M| 45106 (1)| 00:09:02 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
1 - access(UPPER("FSRC"."FAX_NUMBER")=UPPER("FS"."DESTINATION"))
3 - filter("FSRC"."IS_DELETED"='N')
4 - access("GBM"."BU_ID"="FSRC"."BUID")
filter("GBM"."BU_ID" IS NOT NULL)
5 - filter(UPPER("FS"."FAX_STATUS")=SYS_OP_C2C(:B1))
21 rows selected.
--NEW with indexes.
PLAN_TABLE_OUTPUT
Plan hash value: 665032407
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 5995 | 3986K| 3117 (1)| 00:00:38 |
|* 1 | HASH JOIN | | 5995 | 3986K| 3117 (1)| 00:00:38 |
| 2 | NESTED LOOPS | | 611 | 47658 | 20 (5)| 00:00:01 |
|* 3 | VIEW | index$_join$_002 | 2290 | 165K| 20 (5)| 00:00:01 |
|* 4 | HASH JOIN | | | | | |
|* 5 | HASH JOIN | | | | | |
PLAN_TABLE_OUTPUT
| 6 | BITMAP CONVERSION TO ROWIDS| | 2290 | 165K| 1 (0)| 00:00:01 |
|* 7 | BITMAP INDEX SINGLE VALUE | IDX_IS_DELETED_RAM | | | | |
| 8 | INDEX FAST FULL SCAN | IDX_BUID_RAM | 2290 | 165K| 8 (0)| 00:00:01 |
| 9 | INDEX FAST FULL SCAN | IDX_FAX_NUMBER_RAM | 2290 | 165K| 14 (0)| 00:00:01 |
|* 10 | INDEX RANGE SCAN | GLOBAL_BU_MAPPING_BUID | 1 | 4 | 0 (0)| 00:00:01 |
| 11 | TABLE ACCESS BY INDEX ROWID | FAX_STAGE | 23245 | 13M| 3096 (1)| 00:00:38 |
|* 12 | INDEX RANGE SCAN | IDX_UPPER_FAX_STATUS_RAM | 9298 | | 2434 (1)| 00:00:30 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
1 - access(UPPER("DESTINATION")="FSRC"."SYS_NC00035$")
3 - filter("FSRC"."IS_DELETED"='N')
4 - access(ROWID=ROWID)
5 - access(ROWID=ROWID)
7 - access("FSRC"."IS_DELETED"='N')
10 - access("GBM"."BU_ID"="FSRC"."BUID")
filter("GBM"."BU_ID" IS NOT NULL)
12 - access(UPPER("FAX_STATUS")=SYS_OP_C2C(:B1))
31 rows selected
Please confirm on the DBA comment.Is this bitmap index locks rows in my case.
Thanks.>
Maybe you are looking for
-
Dear SAP Friends, I want to define release authorisation of P.O.as per the User ID. I want 3 user for realese the P.O. 1) Material Manager 2) Purchase Offier 3) Account dept Head. These all people release the P.O.by there seperate user Id.which one t
-
I am experimenting with Screen Share in Lion (did not use in SL) and am having latency issues. MacBook taking control of iMac i7 quad core not too bad but iMac i7 Quad Core controlling MacBook is horrendous. Any ideas to speed things up? Also tryin
-
Hi everyone, I have an album art problem: All of my songs and albums have album art. Since iOS 5.0.1, in album view in the music app there is no album art preview. It still displays art when playing music and in cover flow. Does anyone know how to fi
-
HT5085 icloud is disable on my iphone 4s
icloud is disable on my iphone 4s. All Contacts, mails are disabled. How I recover all these.
-
Aperture Library and iPhoto library are different sizes for the SAME images
Hi. I'm a PROUD new Aperture owner (licensee) since last night. YIPPEE!!! I imported my photos from iPhoto without a hitch. The same number of images, and I can access them all. Now, I know the two apps do different things, but I was expecting parity