Query taking long time to run.
The following query is taking long time to run, is there anything can be done to make it run faster by changing the sql etc.
select distinct
A.DEPTID,
A.POSITION_NBR,
A.EMPLID,
A.EMPL_RCD_NBR,
A.EFFDT,
B.NAME,
A.EMPL_STATUS,
A.JOBCODE,
A.ANNUAL_RT,
A.STD_HOURS,
A.PRIMARY_JOB,
C.POSN_STATUS,
case when A.POSITION_NBR = ' ' then 0 else C.STD_HOURS end,
case when A.POSITION_NBR = ' ' then ' ' else C.DEPTID end
from PS_JOB A,
PS_PERSONAL_DATA B,
PS_POSITION_DATA C
where A.EMPLID = B.EMPLID
and
((A.POSITION_NBR = C.POSITION_NBR
and A.EFFSEQ = (select max(D.EFFSEQ)
from PS_JOB D
where D.EMPLID = A.EMPLID
and D.EMPL_RCD_NBR = A.EMPL_RCD_NBR
and D.EFFDT = A.EFFDT)
and C.POSN_STATUS <> 'G'
and C.EFFDT = (select max(E.EFFDT)
from PS_POSITION_DATA E
where E.POSITION_NBR = A.POSITION_NBR
and E.EFFDT <= A.EFFDT)
and C.EFFSEQ = (select max(F.EFFSEQ)
from PS_POSITION_DATA F
where F.POSITION_NBR = A.POSITION_NBR
and F.EFFDT = C.EFFDT))
or
(A.POSITION_NBR = C.POSITION_NBR
and A.EFFDT = (select max(D.EFFDT)
from PS_JOB D
where D.EMPLID = A.EMPLID
and D.EMPL_RCD_NBR = A.EMPL_RCD_NBR
and D.EFFDT <= C.EFFDT)
and A.EFFSEQ = (select max(E.EFFSEQ)
from PS_JOB E
where E.EMPLID = A.EMPLID
and E.EMPL_RCD_NBR = A.EMPL_RCD_NBR
and E.EFFDT = A.EFFDT)
and C.POSN_STATUS <> 'G'
and C.EFFSEQ = (select max(F.EFFSEQ)
from PS_POSITION_DATA F
where F.POSITION_NBR = A.POSITION_NBR
and F.EFFDT = C.EFFDT)))
or
(A.POSITION_NBR = ' '
and A.EFFSEQ = (select max(E.EFFSEQ)
from PS_JOB D
where D.EMPLID = A.EMPLID
and E.EMPL_RCD_NBR = A.EMPL_RCD_NBR
and D.EFFDT = A.EFFDT)))
Using distributive law A and (B or C) = (A and B) or (A and C) from right to left we can have:
select distinct A.DEPTID,A.POSITION_NBR,A.EMPLID,A.EMPL_RCD_NBR,A.EFFDT,B.NAME,A.EMPL_STATUS,
A.JOBCODE,A.ANNUAL_RT,A.STD_HOURS,A.PRIMARY_JOB,C.POSN_STATUS,
case when A.POSITION_NBR = ' ' then 0 else C.STD_HOURS end,
case when A.POSITION_NBR = ' ' then ' ' else C.DEPTID end
from PS_JOB A,PS_PERSONAL_DATA B,PS_POSITION_DATA C
where A.EMPLID = B.EMPLID
and (
A.POSITION_NBR = C.POSITION_NBR
and A.EFFSEQ = (select max(D.EFFSEQ)
from PS_JOB D
where D.EMPLID = A.EMPLID
and D.EMPL_RCD_NBR = A.EMPL_RCD_NBR
and D.EFFDT = A.EFFDT
and C.EFFSEQ = (select max(F.EFFSEQ)
from PS_POSITION_DATA E
where E.POSITION_NBR = A.POSITION_NBR
and E.EFFDT = C.EFFDT
and C.POSN_STATUS != 'G'
and (
C.EFFDT = (select max(E.EFFDT)
from PS_POSITION_DATA E
where E.POSITION_NBR = A.POSITION_NBR
and E.EFFDT <= A.EFFDT
or
A.EFFDT = (select max(D.EFFDT)
from PS_JOB D
where D.EMPLID = A.EMPLID
and D.EMPL_RCD_NBR = A.EMPL_RCD_NBR
and D.EFFDT <= C.EFFDT
or
A.POSITION_NBR = ' '
and A.EFFSEQ = (select max(E.EFFSEQ)
from PS_JOB D
where D.EMPLID = A.EMPLID
and E.EMPL_RCD_NBR = A.EMPL_RCD_NBR
and D.EFFDT = A.EFFDT
)may not help much as the optimizer might have guessed it already
Regards
Etbin
Similar Messages
-
Select Query taking long time to run second time
Hi All,
I have Oracle 11gR1 in windows server 2008 R2 .
I have some tables with 10 million records . When i run the select query for those tables first time it gives me result in 15 seconds but if i am running the same script second time from the same session I am getting the result in 15 minutes to complete ..
Why it is happening? What may be the solution for this ?
Thanks & Regards,
Vikash jain(Junior DBA)Hi Mohamed,
I just saw that both the times for the same query execution plan is different ..
here are the details :
First time Second Time
g84m3qqjv2p3q g84m3qqjv2p3q
2733045235 1310485984
So plz tell me how should i force database to use the first execution plan ?
I got this script for forcing the Db to use the same execution plan
accept sql_id -
prompt 'Enter value for sql_id: ' -
default 'X0X0X0X0'
accept plan_hash_value -
prompt 'Enter value for plan_hash_value: ' -
default 'X0X0X0X0'
accept fixed -
prompt 'Enter value for fixed (NO): ' -
default 'NO'
accept enabled -
prompt 'Enter value for enabled (YES): ' -
default 'YES'
accept plan_name -
prompt 'Enter value for plan_name (ID_sqlid_planhashvalue): ' -
default 'X0X0X0X0'
set feedback off
set sqlblanklines on
set serveroutput on
declare
l_plan_name varchar2(40);
l_old_plan_name varchar2(40);
l_sql_handle varchar2(40);
ret binary_integer;
l_sql_id varchar2(13);
l_plan_hash_value number;
l_fixed varchar2(3);
l_enabled varchar2(3);
major_release varchar2(3);
minor_release varchar2(3);
begin
select regexp_replace(version,'\..*'), regexp_substr(version,'[0-9]+',1,2) into major_release, minor_release from v$instance;
minor_release := 2;
l_sql_id := '&&sql_id';
l_plan_hash_value := to_number('&&plan_hash_value');
l_fixed := '&&fixed';
l_enabled := '&&enabled';
ret := dbms_spm.load_plans_from_cursor_cache(
sql_id=>l_sql_id,
plan_hash_value=>l_plan_hash_value,
fixed=>l_fixed,
enabled=>l_enabled);
if minor_release = '1' then
-- 11gR1 has a bug that prevents renaming Baselines
dbms_output.put_line(' ');
dbms_output.put_line('Baseline created.');
dbms_output.put_line(' ');
else
-- This statements looks for Baselines create in the last 4 seconds
select sql_handle, plan_name,
decode('&&plan_name','X0X0X0X0','SQLID_'||'&&sql_id'||'_'||'&&plan_hash_value','&&plan_name')
into l_sql_handle, l_old_plan_name, l_plan_name
from dba_sql_plan_baselines spb
where created > sysdate-(1/24/60/15);
ret := dbms_spm.alter_sql_plan_baseline(
sql_handle=>l_sql_handle,
plan_name=>l_old_plan_name,
attribute_name=>'PLAN_NAME',
attribute_value=>l_plan_name);
dbms_output.put_line(' ');
dbms_output.put_line('Baseline '||upper(l_plan_name)||' created.');
dbms_output.put_line(' ');
end if;
end;
undef sql_id
undef plan_hash_value
undef plan_name
undef fixed
set feedback on
Output:
Enter value for sql_id: g84m3qqjv2p3q
Enter value for plan_hash_value: 2733045235
Enter value for fixed (NO):
Enter value for enabled (YES):
Enter value for plan_name (ID_sqlid_planhashvalue): g84m3qqjv2p3q
old 16: l_sql_id := '&&sql_id';
new 16: l_sql_id := 'g84m3qqjv2p3q';
old 17: l_plan_hash_value := to_number('&&plan_hash_value');
new 17: l_plan_hash_value := to_number('2733045235');
old 18: l_fixed := '&&fixed';
new 18: l_fixed := 'NO';
old 19: l_enabled := '&&enabled';
new 19: l_enabled := 'YES';
old 40: decode('&&plan_name','X0X0X0X0','SQLID_'||'&&sql_id'||'_'||'&&plan_hash_value','&&plan_name')
new 40: decode('g84m3qqjv2p3q','X0X0X0X0','SQLID_'||'g84m3qqjv2p3q'||'_'||'2733045235','g84m3qqjv2p3q')
declare
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 39
Kindly help me to resolve the issue ..
Thanks & Regards,
Vikash Jain(Junior DBA) -
Queries taking long time to run
Hi BW Folks,
I am working on virtual cube 0bcs_vc10 for bcs(business consolidation) the base cube is 0bcs_c10. We compressed and partitioned the base cube. The queries which i developed are running fine and are in production.
Now when a new req came for some more queries after developing them and running in DEv they are taking 20 to 25 mins to run.
Suprisingly the queries which are running in production they are also taking long time to run, we havent disturbed the performance tuning process we did earlier .
Can any one of share their experience in how to tackle this. Will assign full points
THanksHi Nick,
Do you have a lot of navigational attributes? That could be slowing you down. Also, if it's going too slow, try caching and pre-calculation (pre-loads the cache). Although I'm not sure if this will work with a Virtual Cube. By their nature they will be much slower than a physical cube.....so worst case scenario for me would be to load the VC data into a regular cube. If the query is still slow, then at least you know it's a query issue and not the VC.
Brian -
Query taking long time for EXTRACTING the data more than 24 hours
Hi ,
Query taking long time for EXTRACTING the data more than 24 hours please find the query and explain plan details below even indexes avilable on table's goe's to FULL TABLE SCAN. please suggest me.......
SQL> explain plan for select a.account_id,round(a.account_balance,2) account_balance,
2 nvl(ah.invoice_id,ah.adjustment_id) transaction_id,
to_char(ah.effective_start_date,'DD-MON-YYYY') transaction_date,
to_char(nvl(i.payment_due_date,
to_date('30-12-9999','dd-mm-yyyy')),'DD-MON-YYYY')
due_date, ah.current_balance-ah.previous_balance amount,
decode(ah.invoice_id,null,'A','I') transaction_type
3 4 5 6 7 8 from account a,account_history ah,invoice i_+
where a.account_id=ah.account_id
and a.account_type_id=1000002
and round(a.account_balance,2) > 0
and (ah.invoice_id is not null or ah.adjustment_id is not null)
and ah.CURRENT_BALANCE > ah.previous_balance
and ah.invoice_id=i.invoice_id(+)
AND a.account_balance > 0
order by a.account_id,ah.effective_start_date desc; 9 10 11 12 13 14 15 16
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
| 0 | SELECT STATEMENT | | 544K| 30M| | 693K (20)|
| 1 | SORT ORDER BY | | 544K| 30M| 75M| 693K (20)|
|* 2 | HASH JOIN | | 544K| 30M| | 689K (20)|
|* 3 | TABLE ACCESS FULL | ACCOUNT | 20080 | 294K| | 6220 (18)|
|* 4 | HASH JOIN OUTER | | 131M| 5532M| 5155M| 678K (20)|
|* 5 | TABLE ACCESS FULL| ACCOUNT_HISTORY | 131M| 3646M| | 197K (25)|
| 6 | TABLE ACCESS FULL| INVOICE | 262M| 3758M| | 306K (18)|
Predicate Information (identified by operation id):
2 - access("A"."ACCOUNT_ID"="AH"."ACCOUNT_ID")
3 - filter("A"."ACCOUNT_TYPE_ID"=1000002 AND "A"."ACCOUNT_BALANCE">0 AND
ROUND("A"."ACCOUNT_BALANCE",2)>0)
4 - access("AH"."INVOICE_ID"="I"."INVOICE_ID"(+))
5 - filter("AH"."CURRENT_BALANCE">"AH"."PREVIOUS_BALANCE" AND ("AH"."INVOICE_ID"
IS NOT NULL OR "AH"."ADJUSTMENT_ID" IS NOT NULL))
22 rows selected.
Index Details:+_
SQL> select INDEX_OWNER,INDEX_NAME,COLUMN_NAME,TABLE_NAME from dba_ind_columns where
2 table_name in ('INVOICE','ACCOUNT','ACCOUNT_HISTORY') order by 4;
INDEX_OWNER INDEX_NAME COLUMN_NAME TABLE_NAME
OPS$SVM_SRV4 P_ACCOUNT ACCOUNT_ID ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT_NAME ACCOUNT_NAME ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT CUSTOMER_NODE_ID ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT ACCOUNT_TYPE_ID ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_ACCOUNT_TYPE ACCOUNT_TYPE_ID ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_INVOICE INVOICE_ID ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_PREVIOUS_INVOICE PREVIOUS_INVOICE_ID ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_NAME ACCOUNT
OPS$SVM_SRV4 U_ACCOUNT_NAME_ID ACCOUNT_ID ACCOUNT
OPS$SVM_SRV4 I_LAST_MODIFIED_ACCOUNT LAST_MODIFIED ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_INVOICE_ACCOUNT INVOICE_ACCOUNT_ID ACCOUNT
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT ACCOUNT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ACCOUNT SEQNR ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_INVOICE INVOICE_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV INVOICE_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA CURRENT_BALANCE ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA INVOICE_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ADJUSTMENT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_CIA ACCOUNT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_LMOD LAST_MODIFIED ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADINV ADJUSTMENT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_PAYMENT PAYMENT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_ADJUSTMENT ADJUSTMENT_ID ACCOUNT_HISTORY
OPS$SVM_SRV4 I_ACCOUNT_HISTORY_APPLIED_DT APPLIED_DATE ACCOUNT_HISTORY
OPS$SVM_SRV4 P_INVOICE INVOICE_ID INVOICE
OPS$SVM_SRV4 U_INVOICE CUSTOMER_INVOICE_STR INVOICE
OPS$SVM_SRV4 I_LAST_MODIFIED_INVOICE LAST_MODIFIED INVOICE
OPS$SVM_SRV4 U_INVOICE_ACCOUNT ACCOUNT_ID INVOICE
OPS$SVM_SRV4 U_INVOICE_ACCOUNT BILL_RUN_ID INVOICE
OPS$SVM_SRV4 I_INVOICE_BILL_RUN BILL_RUN_ID INVOICE
OPS$SVM_SRV4 I_INVOICE_INVOICE_TYPE INVOICE_TYPE_ID INVOICE
OPS$SVM_SRV4 I_INVOICE_CUSTOMER_NODE CUSTOMER_NODE_ID INVOICE
32 rows selected.
Regards,
Bathula
Oracle-DBAI have some suggestions. But first, you realize that you have some redundant indexes, right? You have an index on account(account_name) and also account(account_name, account_id), and also account_history(invoice_id) and account_history(invoice_id, adjustment_id). No matter, I will suggest some new composite indexes.
Also, you do not need two lines for these conditions:
and round(a.account_balance, 2) > 0
AND a.account_balance > 0
You can just use: and a.account_balance >= 0.005
So the formatted query isselect a.account_id,
round(a.account_balance, 2) account_balance,
nvl(ah.invoice_id, ah.adjustment_id) transaction_id,
to_char(ah.effective_start_date, 'DD-MON-YYYY') transaction_date,
to_char(nvl(i.payment_due_date, to_date('30-12-9999', 'dd-mm-yyyy')),
'DD-MON-YYYY') due_date,
ah.current_balance - ah.previous_balance amount,
decode(ah.invoice_id, null, 'A', 'I') transaction_type
from account a, account_history ah, invoice i
where a.account_id = ah.account_id
and a.account_type_id = 1000002
and (ah.invoice_id is not null or ah.adjustment_id is not null)
and ah.CURRENT_BALANCE > ah.previous_balance
and ah.invoice_id = i.invoice_id(+)
AND a.account_balance >= .005
order by a.account_id, ah.effective_start_date desc;You will probably want to select:
1. From ACCOUNT first (your smaller table), for which you supply a literal on account_type_id. That should limit the accounts retrieved from ACCOUNT_HISTORY
2. From ACCOUNT_HISTORY. We want to limit the records as much as possible on this table because of the outer join.
3. INVOICE we want to access last because it seems to be least restricted, it is the biggest, and it has the outer join condition so it will manufacture rows to match as many rows as come back from account_history.
Try the query above after creating the following composite indexes. The order of the columns is important:create index account_composite_i on account(account_type_id, account_balance, account_id);
create index acct_history_comp_i on account_history(account_id, invoice_id, adjustment_id, current_balance, previous_balance, effective_start_date);
create index invoice_composite_i on invoice(invoice_id, payment_due_date);All the columns used in the where clause will be indexed, in a logical order suited to the needs of the query. Plus each selected column is indexed as well so that we should not need to touch the tables at all to satisfy the query.
Try the query after creating these indexes.
A final suggestion is to try larger sort and hash area sizes and a manual workarea policy.alter session set workarea_size_policy = manual;
alter session set sort_area_size = 2147483647;
alter session set hash_area_size = 2147483647; -
------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 -
Sap bi--query taking long time to exexute
Hi
When i try run the bex query ,its taking long time,please suggest
Thanks
sreedharHi
When i try run the bex query ,its taking long time,please suggest
Thanks
sreedhar -
Taking long time to run a jobs-in programRBDMIDOC
hi expert
hope all r doing well.i have one issue related to jobs which is taking long time
40 hrs.so please any body help me on this issue. i am giving information related
to issue as below
job name:"J4674-sd-pric-cond-chng-for-vncl" this job is running with program
RBDMIDOC
Job name:"j2378-fi-auto-clear-wo-curr-all" this job is running with program
SAPFI24
can anybady tell me what is the reason its taking so long time.or for improving
performance any OSS note require .
please suggest me the solution
awating for quick response.
Regards
Nisha ADear rob,
thanks for your quick response,as you have given the OSS note
but i discussed with ABAPER but they say this will not support
so please can you give me other note no so,that we can do some
thing to wipe out problem.i am awaiting for your valuable response
Regds
Nisha A -
CDHDR table query taking long time
Hi all,
Select query from CDHDR table is taking long time,in where condition i am giving OBJECTCLASS = 'MAT_FULL' udate = sy-datum and langu = 'EN'.
any suggestion to improve the performance.i want to select all the article which got changed on current date
regards
shibuThis will always be slow for large data volumes, since CDHDR is designed for quick access by object ID (in this case material number), not by date.
I'm afraid you would need to introduce a secondary index on OBJECTCLAS and UDATE, if that query is crucial enough to warrant the additional disk space and processing time taken by the new index.
Greetings
Thomas -
Where would you check performance of webi? query is taking long time to run
Hello All,
In the bex query world running on portal you were able to go to sm50 and check what the query is doing and where it is taking a long time or atleast you were able to see the processes runing.
Where would you check the running processes when you are running a webi query, we are trying to write a webi report which is on universe which is created on bex query. The report is very simple just two fields and an mandatory variable which is coming from bex query (have defined the variable in bex query). When we exeute the query it is taking a long time just spinning and I am not getting any data back, on the same query before even hitting the run query button, I am trying to put a object in query filters and set the filter as In list from Value(s) from list and it is taking forever to set that filter.
Can we go to CMC or BW backend and check anywhere we are using sap authentication, I see the number of sessions in CMC but that is it.
Thanks for help in advance.Thank you both for the replies.
How would I get the MDX that is generated by the query, I remember there is a note for starting the MDX logging. Can you please let em know how would I get the MDX statement. Thanks.
Gowtham - What is the optimal array fetch size that needs to set for the universes, can you explain bit more about array fetch size?
All our universes are on BEx queries designed in SAP BW in that case does the array fetch size matter and array bind size matter? I had read this in oneof the universe designer manuals for OLAP universes The Array fetch size, Array bind size, and Login timeout parameters are not used for OLAP connections
Thanks again for replies. -
Infopackage in process chain taking long time to run
HI Experts,
One of the element (Infopackage) in process chain(Daily process chain) is taking much longer time(6 hr and still runing) as generally it takes 15-20 mins to complete and the status is in yellow and still running in process monitor without giving any clear picture of error. Manually we are making the staus red and we are updating from PSA and this time it is getting completed in time as specified.
Flow from PSA to datatarget(DSO) in series
For last one week we are facing same issue and i would like to mention that we don't have access to SM37,SM12 to look the logs
and any locks.
without this i need to investigate what is the root cause for the same.
with regards,
muraliHi,
please find the job log.
Date
Time
Message
MsgID/No./Ty
13.12.2010
21:45:30
Job started
00
516
S
13.12.2010
21:45:30
Step 001 started (program SBIE0001, variant &0000000109368, user ID RFCUSER)
00
550
S
13.12.2010
21:45:30
Asynchronous transmission of info IDoc 2 in task 0001 (0 parallel tasks)
R3
413
S
13.12.2010
21:45:30
DATASOURCE = 2LIS_17_I3HDR
R3
299
S
13.12.2010
21:45:30
RLOGSYS = PBACLNT200
R3
299
S
13.12.2010
21:45:30
REQUNR = REQU_D9GSSV08BTS93Z6Y7XWP1ZEUJ
R3
299
S
13.12.2010
21:45:30
UPDMODE = D
R3
299
S
13.12.2010
21:45:30
LANGUAGES = *
R3
299
S
13.12.2010
21:45:30
R8
048
S
13.12.2010
21:45:30
Current Values for Selected Profile Parameters *
R8
049
S
13.12.2010
21:45:30
R8
048
S
13.12.2010
21:45:30
abap/heap_area_nondia......... 0 *
R8
050
S
13.12.2010
21:45:30
abap/heap_area_total.......... 25500319744 *
R8
050
S
13.12.2010
21:45:30
abap/heaplimit................ 40000000 *
R8
050
S
13.12.2010
21:45:30
zcsa/installed_languages...... ED *
R8
050
S
13.12.2010
21:45:30
zcsa/system_language.......... E *
R8
050
S
13.12.2010
21:45:30
ztta/max_memreq_MB............ 2047 *
R8
050
S
13.12.2010
21:45:30
ztta/roll_area................ 3000320 *
R8
050
S
13.12.2010
21:45:30
ztta/roll_extension........... 2000000000 *
R8
050
S
13.12.2010
21:45:30
R8
048
S
13.12.2010
21:45:31
70 LUWs confirmed and 70 LUWs to be deleted with function module RSC2_QOUT_CONFIRM_DATA
RSQU
036
S
13.12.2010
21:45:33
Call customer enhancement BW_BTE_CALL_BW204010_E (BTE) with 9,895 records
R3
407
S
13.12.2010
21:45:33
Result of customer enhancement: 9,895 records
R3
408
S
13.12.2010
21:45:33
Call customer enhancement EXIT_SAPLRSAP_001 (CMOD) with 9,895 records
R3
407
S
13.12.2010
21:45:33
Result of customer enhancement: 9,895 records
R3
408
S
13.12.2010
21:45:33
PSA=0 USING & STARTING SAPI SCHEDULER
R3
299
S
13.12.2010
21:45:33
Asynchronous send of data package 1 in task 0002 (1 parallel tasks)
R3
409
S
13.12.2010
21:45:34
IDOC: Info IDoc 2, IDoc No. 5136702, Duration 00:00:00
R3
088
S
13.12.2010
21:45:34
IDoc: Start = 13.12.2010 21:45:30, End = 13.12.2010 21:45:30
R3
089
S
13.12.2010
21:45:35
Asynchronous transmission of info IDoc 3 in task 0003 (1 parallel tasks)
R3
413
S
13.12.2010
21:45:35
Altogether, 0 records were filtered out through selection conditions
RSQU
037
S
13.12.2010
21:45:35
IDOC: Info IDoc 3, IDoc No. 5136703, Duration 00:00:00
R3
088
S
13.12.2010
21:45:35
IDoc: Start = 13.12.2010 21:45:35, End = 13.12.2010 21:45:35
R3
089
S
13.12.2010
21:55:37
tRFC: Data Package = 1, TID = 0AF0842B00C84D0694000F00, Duration = 00:10:03, ARFCSTATE = SYSFAIL
R3
038
S
13.12.2010
21:55:37
tRFC: Start = 13.12.2010 21:45:34, End = 13.12.2010 21:55:37
R3
039
S
13.12.2010
21:55:37
Synchronized transmission of info IDoc 4 (0 parallel tasks)
R3
414
S
13.12.2010
21:55:37
IDOC: Info IDoc 4, IDoc No. 5136717, Duration 00:00:00
R3
088
S
13.12.2010
21:55:37
IDoc: Start = 13.12.2010 21:55:37, End = 13.12.2010 21:55:37
R3
089
S
13.12.2010
21:55:37
Job finished
00
517
S -
Query taking long time To Fectch the Results
Hi!
when I run the query,it takes too long time for fetching the resultsets.
Please find the query below for the same.
SELECT
A.BUSINESS_UNIT,
A.JOURNAL_ID,
TO_CHAR(A.JOURNAL_DATE,'YYYY-MM-DD'),
A.UNPOST_SEQ,
A.FISCAL_YEAR,
A.ACCOUNTING_PERIOD,
A.JRNL_HDR_STATUS,
C.INVOICE,
C.ACCT_ENTRY_TYPE,
C.LINE_DST_SEQ_NUM,
C.TAX_AUTHORITY_CD,
C.ACCOUNT,
C.MONETARY_AMOUNT,
D.BILL_SOURCE_ID,
D.IDENTIFIER,
D.VAT_AMT_BSE,
D.VAT_TRANS_AMT_BSE,
D.VAT_TXN_TYPE_CD,
D.TAX_CD_VAT,
D.TAX_CD_VAT_PCT,
D.VAT_APPLICABILITY,
E.BILL_TO_CUST_ID,
E.BILL_STATUS,
E.BILL_CYCLE_ID,
TO_CHAR(E.INVOICE_DT,'YYYY-MM-DD'),
TO_CHAR(E.ACCOUNTING_DT,'YYYY-MM-DD'),
TO_CHAR(E.DT_INVOICED,'YYYY-MM-DD'),
E.ENTRY_TYPE,
E.ENTRY_REASON,
E.AR_LVL,
E.AR_DST_OPT,
E.AR_ENTRY_CREATED,
E.GEN_AR_ITEM_FLG,
E.GL_LVL, E.GL_ENTRY_CREATED,
(Case when c.account in ('30120000','30180050','30190000','30290000','30490000',
'30690000','30900040','30990000','35100000','35120000','35150000','35160000',
'39100050','90100000')
and D.TAX_CD_VAT_PCT <> 0 then 'Ej_Momskonto_med_moms'
When c.account not in ('30120000','30180050','30190000','30290000',
'30490000','30690000','30900040','30990000','35100000','35120000','35150000',
'35160000','39100050','90100000')
and D.TAX_CD_VAT_PCT <> 25 then 'Momskonto_utan_moms' end)
FROM
sysadm.PS_JRNL_HEADER A,
sysadm.PS_JRNL_LN B,
sysadm.PS_BI_ACCT_ENTRY C,
sysadm.PS_BI_LINE D,
sysadm.PS_BI_HDR E
WHERE A.BUSINESS_UNIT = '&BU'
AND A.JOURNAL_DATE BETWEEN TO_DATE('&From_date','YYYY-MM-DD')
AND TO_DATE('&To_date','YYYY-MM-DD')
AND A.SOURCE = 'BI'
AND A.BUSINESS_UNIT = B.BUSINESS_UNIT
AND A.JOURNAL_ID = B.JOURNAL_ID
AND A.JOURNAL_DATE = B.JOURNAL_DATE
AND A.UNPOST_SEQ = B.UNPOST_SEQ
AND B.BUSINESS_UNIT = C.BUSINESS_UNIT
AND B.JOURNAL_ID = C.JOURNAL_ID
AND B.JOURNAL_DATE = C.JOURNAL_DATE
AND B.JOURNAL_LINE = C.JOURNAL_LINE
AND C.ACCT_ENTRY_TYPE = 'RR'
AND C.BUSINESS_UNIT = '&BU'
AND C.BUSINESS_UNIT = D.BUSINESS_UNIT
AND C.INVOICE = D.INVOICE
AND C.LINE_SEQ_NUM = D.LINE_SEQ_NUM
AND D.BUSINESS_UNIT = '&BU'
AND D.BUSINESS_UNIT = E.BUSINESS_UNIT
AND D.INVOICE = E.INVOICE
AND E.BUSINESS_UNIT = '&BU'
AND
((c.account in ('30120000','30180050','30190000','30290000','30490000',
'30690000','30900040','30990000','35100000','35120000','35150000','35160000',
'39100050','90100000')
and D.TAX_CD_VAT_PCT <> 0)
OR
(c.account not in ('30120000','30180050','30190000','30290000','30490000',
'30690000','30900040','30990000','35100000','35120000','35150000','35160000',
'39100050','z')
and D.TAX_CD_VAT_PCT <> 25)
GROUP BY
A.BUSINESS_UNIT,
A.JOURNAL_ID,
TO_CHAR(A.JOURNAL_DATE,'YYYY-MM-DD'),
A.UNPOST_SEQ, A.FISCAL_YEAR,
A.ACCOUNTING_PERIOD,
A.JRNL_HDR_STATUS,
C.INVOICE,
C.ACCT_ENTRY_TYPE,
C.LINE_DST_SEQ_NUM,
C.TAX_AUTHORITY_CD,
C.ACCOUNT,
D.BILL_SOURCE_ID,
D.IDENTIFIER,
D.VAT_TXN_TYPE_CD,
D.TAX_CD_VAT,
D.TAX_CD_VAT_PCT,
D.VAT_APPLICABILITY,
E.BILL_TO_CUST_ID,
E.BILL_STATUS,
E.BILL_CYCLE_ID,
TO_CHAR(E.INVOICE_DT,'YYYY-MM-DD'),
TO_CHAR(E.ACCOUNTING_DT,'YYYY-MM-DD'),
TO_CHAR(E.DT_INVOICED,'YYYY-MM-DD'),
E.ENTRY_TYPE, E.ENTRY_REASON,
E.AR_LVL, E.AR_DST_OPT,
E.AR_ENTRY_CREATED,
E.GEN_AR_ITEM_FLG,
E.GL_LVL,
E.GL_ENTRY_CREATED,
C.MONETARY_AMOUNT,
D.VAT_AMT_BSE,
D.VAT_TRANS_AMT_BSE
having
(Case when c.account in ('30120000','30180050','30190000','30290000',
'30490000','30690000','30900040','30990000','35100000','35120000','35150000',
'35160000','39100050','90100000')
and D.TAX_CD_VAT_PCT <> 0 then 'Ej_Momskonto_med_moms'
When c.account not in ('30120000','30180050','30190000','30290000','30490000',
'30690000','30900040','30990000','35100000','35120000','35150000','35160000',
'39100050','90100000')
and D.TAX_CD_VAT_PCT <> 25 then 'Momskonto_utan_moms' end) is not null
So Could you provide the solution to fix this issue?
Thanks
senthil[url http://forums.oracle.com/forums/thread.jspa?threadID=501834&tstart=0]When your query takes too long ...
Regards,
Rob. -
the below query is taking very long time.
select /*+ PARALLEL(a,8) PARALLEL(b,8) */ a.personid,a.winning_id, b.questionid from
winning_id_cleanup a , rm_personquestion b
where a.personid = b.personid and (a.winning_id,b.questionid) not in
(select /*+ PARALLEL(c,8) */ c.personid,c.questionid from rm_personquestion c where c.personid=a.winning_id);
where the rm_personquestion table is having 45 million rows and winning_id_cleanup is having 1 million rows.
please tell me how to tune this query?Please post u'r query at PL/SQL
It's not for SQL and PL/SQL -
SQL Query taking longer time as seen from Trace file
Below Query Execution timings:
Any help will be benefitial as its affecting business needs.
SELECT MATERIAL_DETAIL_ID
FROM
GME_MATERIAL_DETAILS WHERE BATCH_ID = :B1 FOR UPDATE OF ACTUAL_QTY NOWAIT
call count cpu elapsed disk query current rows
Parse 1 0.00 0.70 0 0 0 0
Execute 2256 8100.00 24033.51 627 12298 31739 0
Fetch 2256 900.00 949.82 0 12187 0 30547
total 4513 9000.00 24984.03 627 24485 31739 30547
Thanks and RegardsThanks Buddy.
Data Collected from Trace file:
SELECT STEP_CLOSE_DATE
FROM
GME_BATCH_STEPS WHERE BATCH_ID
IN (SELECT
DISTINCT BATCH_ID FROM
GME_MATERIAL_DETAILS START WITH BATCH_ID = :B2 CONNECT BY PRIOR PHANTOM_ID=BATCH_ID)
AND NVL(STEP_CLOSE_DATE, :B1) > :B1
call count cpu elapsed disk query current rows
Parse 1 0.00 0.54 0 0 0 0
Execute 2256 800.00 1120.32 0 0 0 0
Fetch 2256 9100.00 13551.45 396 77718 0 0
total 4513 9900.00 14672.31 396 77718 0 0
Misses in library cache during parse: 0
Optimizer goal: CHOOSE
Parsing user id: 66 (recursive depth: 1)
Rows Row Source Operation
0 TABLE ACCESS BY INDEX ROWID GME_BATCH_STEPS
13160 NESTED LOOPS
6518 VIEW
6518 SORT UNIQUE
53736 CONNECT BY WITH FILTERING
30547 NESTED LOOPS
30547 INDEX RANGE SCAN GME_MATERIAL_DETAILS_U1 (object id 146151)
30547 TABLE ACCESS BY USER ROWID GME_MATERIAL_DETAILS
23189 NESTED LOOPS
53736 BUFFER SORT
53736 CONNECT BY PUMP
23189 TABLE ACCESS BY INDEX ROWID GME_MATERIAL_DETAILS
23189 INDEX RANGE SCAN GME_MATERIAL_DETAILS_U1 (object id 146151)
4386 INDEX RANGE SCAN GME_BATCH_STEPS_U1 (object id 146144)
In the Package there are lots of SQL Statements using CONNECT BY CLAUSE.
Does the use of CONNECT BY Clause degrades performance?
As you can see the Rows Section is 0 but the Query and elapsed time is taking longer
Regards -
Hi
I have a query in which, its a 3 table join but takes a long time to execute. I had checked with plan table.. it shows one of the table is FULL ACCESS.
I have 2 clarifications.
1. Will the status checking as NULL - (it shouldn't use index)
2. Is the case statements are recommended for queries.
Query
Select .........
FROM CLIENT LEFT OUTER JOIN INTERNET_LOGIN ON INTERNET_LOGIN.NUM_CLIENT_ID=CLIENT.NUM_CLIENT_ID,
POLI_MOT.
WHERE
POLI_MOT.NUM_CLIENT_ID=CLIENT.NUM_CLIENT_ID
AND
(POLI_MOT.CHR_CANCEL_STATUS='N'
OR
POLI_MOT.CHR_CANCEL_STATUS IS NULL)
AND
CLIENT.NUM_CONTACT_TYPE_ID IN (1,3)
AND
(NVL(POLI_MOT.VCH_NEW_IC_NO,'A') =
CASE WHEN (NVL(null,NULL) IS NULL) THEN
NVL(POLI_MOT.VCH_NEW_IC_NO,'A')
ELSE
NVL(null,NULL)
END
OR
POLI_MOT.VCH_OLD_IC_NO =
CASE WHEN nvl(null,null) IS NULL THEN
POLI_MOT.VCH_OLD_IC_NO
ELSE
NVL(null,NULL)
END )
AND POLI_MOT.VCH_POLICY_NO =
CASE WHEN UPPER(nvl(NULL,null)) IS NULL THEN
POLI_MOT.VCH_POLICY_NO
ELSE
NVL(NULL,NULL)
END
AND POLI_MOT.VCH_VEHICLE_NO =
CASE WHEN UPPER(NVL('123',NULL)) IS NULL THEN
POLI_MOT.VCH_VEHICLE_NO
ELSE
NVL('123',NULL)
ENDHi,
There is nothing wrong in having a full table access. When you do the explain plan please check for which table costs you the maximun. try to work on that table.
To tune the performance of your query you can try either indexing or parallel access.
the syntax for parallel index is
/*+ PARALLEL("TBL_NM",100) */(any number)...
for index please use the index name of the table you want to index..
regards
Bharath -
Merge Query Taking Long time !!!
Hi all,
Im using loading type update/insert in one of my mappings.
mapping usually takes 3-4 mins to complete.
Suddenly It has taken 1 Hr to complete. If I take the select query from the mapping, its running fast and completes in 2 mins.
I Checked the source data count, Indexes in the source columns. Everything is the same
Mapping level, I didnt do any changes. Can anyone suggest what would be possible reason???
Thanks and Regards
ElaLots of things come into play when you're tuning a query.
An (unformatted) execution plan isn't enough.
Tuning takes time and understanding how (a lot of) things work, there is no ASAP in the world of tuning.
Please post other important details, like your database version, optimizer settings, how/when are table statistics gathered etc.
So, read the following informative threads (and please take your time, this really is important stuff), and adust your thread as needed.
That way you'll have a bigger chance of getting help that makes sense...
Your DBA should/ought to be able to help you in this as well.
Re: HOW TO: Post a SQL statement tuning request - template posting
http://oracle-randolf.blogspot.com/2009/02/basic-sql-statement-performance.html
Maybe you are looking for
-
My ipod connects to my computer, and shows up in My Computer so i can access the photos but not in ITunes so i cant access my music and movies, ive tried trouble shooting and the other suggestions from this site but nothings working. It hasn't always
-
Envy DV7 laptop will not boot without the power cord being connected
My laptop won't boot on its own even when the battery indicator reads "fully charged (97%). If I have the power cord plugged into the computer (and the wall), it boots right away. Without the power cord, the "power indicator light" flashes once, the
-
Can somone please tell me what I am doing wrong ? I am creating PDF Files with the Adobe Designer, but then when I trying to combine the pdf files with Acrobat Pro, I get an error that those PDF files are protected and can NOT be combinet. As far I c
-
Logic crashing and quitting constantly
And pretty much as soon as its launched. repaired permissions(but there are a small number that dont seem to repair). trashed permissions Can the program logic get corrupted? Anyway, any helpfull suggestions appreciated
-
How do you assign actions to a widget? I have a dropdown menu widget and when the user selects a menu topic, they should go to that topic. How do you assign the action? I am in Cap. 5.