Query Execution taking Longer Time
Hi BI Gurus,
There is one some ABC query which was built on multiprovider, when I am trying to execute it in BEx analyzer in production system it is taking long run and then giving short dump. I have checked data in the multiprovider it is not more than 1lac records. Can any one tell me what is the problem and how can I find the roote cause?
Thanks in advance,
Venkat
Hi,
Even I am facing the same problem above. I am trying to fetch results from a cursor which has subquery running over the db link and placing the results set in a csv file using client_io package. When I run the cursor directly from database (11G), it takes not more than 3-4 min to get the results back. But when I run the same cursor via oracle forms 10G, the query in local database keep on waiting for hours to get results from remote database with "SQL*Net message from dblink". Session on local database remains in active status with state as "Waiting" while the session on remote database goes inactive with state as waiting for event "SQL*Net message from client"
This is confusing me since the same query when ran directly from backend fetches results soon.
Please let me know if anyone can help here
Thanks
Garima
Similar Messages
-
Query execution taking longer time in Oracle form 10g !!
Hi,
I'm generating a report through Oracle form ( forms 10g) and its taking 3-4 hours to finish. But when I run the same report query in (Oracle 11g) database, it gets executed in less than 40 mins.
The form takes only from and to date as input.
I tried hardcoring the date in the Oracle Form and then the report takes only 40 mins to generate.
I tried various approaches like changing the datatypes of form variable and correspondingly changing the query, but met with no success.
When the report in run through the form , we can see the query getting run in backend for nearly 3 hrs !!! tats really confusing !!
Please let me know, if anybody got any idea on this problem??Hi,
Even I am facing the same problem above. I am trying to fetch results from a cursor which has subquery running over the db link and placing the results set in a csv file using client_io package. When I run the cursor directly from database (11G), it takes not more than 3-4 min to get the results back. But when I run the same cursor via oracle forms 10G, the query in local database keep on waiting for hours to get results from remote database with "SQL*Net message from dblink". Session on local database remains in active status with state as "Waiting" while the session on remote database goes inactive with state as waiting for event "SQL*Net message from client"
This is confusing me since the same query when ran directly from backend fetches results soon.
Please let me know if anyone can help here
Thanks
Garima -
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.> -
------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 -
Query optimization - Query is taking long time even there is no table scan in execution plan
Hi All,
The below query execution is taking very long time even there are all required indexes present.
Also in execution plan there is no table scan. I did a lot of research but i am unable to find a solution.
Please help, this is required very urgently. Thanks in advance. :)
WITH cte
AS (
SELECT Acc_ex1_3
FROM Acc_ex1
INNER JOIN Acc_ex5 ON (
Acc_ex1.Acc_ex1_Id = Acc_ex5.Acc_ex5_Id
AND Acc_ex1.OwnerID = Acc_ex5.OwnerID
WHERE (
cast(Acc_ex5.Acc_ex5_92 AS DATETIME) >= '12/31/2010 18:30:00'
AND cast(Acc_ex5.Acc_ex5_92 AS DATETIME) < '01/31/2014 18:30:00'
SELECT DISTINCT R.ReportsTo AS directReportingUserId
,UC.UserName AS EmpName
,UC.EmployeeCode AS EmpCode
,UEx1.Use_ex1_1 AS PortfolioCode
SELECT TOP 1 TerritoryName
FROM UserTerritoryLevelView
WHERE displayOrder = 6
AND UserId = R.ReportsTo
) AS BranchName
,GroupsNotContacted AS groupLastContact
,GroupCount AS groupTotal
FROM ReportingMembers R
INNER JOIN TeamMembers T ON (
T.OwnerID = R.OwnerID
AND T.MemberID = R.ReportsTo
AND T.ReportsTo = 1
INNER JOIN UserContact UC ON (
UC.CompanyID = R.OwnerID
AND UC.UserID = R.ReportsTo
INNER JOIN Use_ex1 UEx1 ON (
UEx1.OwnerId = R.OwnerID
AND UEx1.Use_ex1_Id = R.ReportsTo
INNER JOIN (
SELECT Accounts.AssignedTo
,count(DISTINCT Acc_ex1_3) AS GroupCount
FROM Accounts
INNER JOIN Acc_ex1 ON (
Accounts.AccountID = Acc_ex1.Acc_ex1_Id
AND Acc_ex1.Acc_ex1_3 > '0'
AND Accounts.OwnerID = 109
GROUP BY Accounts.AssignedTo
) TotalGroups ON (TotalGroups.AssignedTo = R.ReportsTo)
INNER JOIN (
SELECT Accounts.AssignedTo
,count(DISTINCT Acc_ex1_3) AS GroupsNotContacted
FROM Accounts
INNER JOIN Acc_ex1 ON (
Accounts.AccountID = Acc_ex1.Acc_ex1_Id
AND Acc_ex1.OwnerID = Accounts.OwnerID
AND Acc_ex1.Acc_ex1_3 > '0'
INNER JOIN Acc_ex5 ON (
Accounts.AccountID = Acc_ex5.Acc_ex5_Id
AND Acc_ex5.OwnerID = Accounts.OwnerID
WHERE Accounts.OwnerID = 109
AND Acc_ex1.Acc_ex1_3 NOT IN (
SELECT Acc_ex1_3
FROM cte
GROUP BY Accounts.AssignedTo
) TotalGroupsNotContacted ON (TotalGroupsNotContacted.AssignedTo = R.ReportsTo)
WHERE R.OwnerID = 109
Please mark it as an answer/helpful if you find it as useful. Thanks, Satya Prakash JugranHi All,
Thanks for the replies.
I have optimized that query to make it run in few seconds.
Here is my final query.
select ReportsTo as directReportingUserId,
UserName AS EmpName,
EmployeeCode AS EmpCode,
Use_ex1_1 AS PortfolioCode,
BranchName,
GroupInfo.groupTotal,
GroupInfo.groupLastContact,
case when exists
(select 1 from ReportingMembers RM
where RM.ReportsTo = UserInfo.ReportsTo
and RM.MemberID <> UserInfo.ReportsTo
) then 0 else UserInfo.ReportsTo end as memberid1,
(select code from Regions where ownerid=109 and name=UserInfo.BranchName) as BranchCode,
ROW_NUMBER() OVER (ORDER BY directReportingUserId) AS ROWNUMBER
FROM
(select distinct R.ReportsTo, UC.UserName, UC.EmployeeCode,UEx1.Use_ex1_1,
(select top 1 TerritoryName
from UserTerritoryLevelView
where displayOrder = 6
and UserId = R.ReportsTo) as BranchName,
Case when R.ReportsTo = Accounts.AssignedTo then Accounts.AssignedTo else 0 end as memberid1
from ReportingMembers R
INNER JOIN TeamMembers T ON (T.OwnerID = R.OwnerID AND T.MemberID = R.ReportsTo AND T.ReportsTo = 1)
inner join UserContact UC on (UC.CompanyID = R.OwnerID and UC.UserID = R.ReportsTo )
inner join Use_ex1 UEx1 on (UEx1.OwnerId = R.OwnerID and UEx1.Use_ex1_Id = R.ReportsTo)
inner join Accounts on (Accounts.OwnerID = 109 and Accounts.AssignedTo = R.ReportsTo)
union
select distinct R.ReportsTo, UC.UserName, UC.EmployeeCode,UEx1.Use_ex1_1,
(select top 1 TerritoryName
from UserTerritoryLevelView
where displayOrder = 6
and UserId = R.ReportsTo) as BranchName,
Case when R.ReportsTo = Accounts.AssignedTo then Accounts.AssignedTo else 0 end as memberid1
from ReportingMembers R
--INNER JOIN TeamMembers T ON (T.OwnerID = R.OwnerID AND T.MemberID = R.ReportsTo)
inner join UserContact UC on (UC.CompanyID = R.OwnerID and UC.UserID = R.ReportsTo)
inner join Use_ex1 UEx1 on (UEx1.OwnerId = R.OwnerID and UEx1.Use_ex1_Id = R.ReportsTo)
inner join Accounts on (Accounts.OwnerID = 109 and Accounts.AssignedTo = R.ReportsTo)
where R.MemberID = 1
) UserInfo
inner join
select directReportingUserId, sum(Groups) as groupTotal, SUM(GroupsNotContacted) as groupLastContact
from
select distinct R.ReportsTo as directReportingUserId, Acc_ex1_3 as GroupName, 1 as Groups,
case when Acc_ex5.Acc_ex5_92 between GETDATE()-365*10 and GETDATE() then 1 else 0 end as GroupsNotContacted
FROM ReportingMembers R
INNER JOIN TeamMembers T
ON (T.OwnerID = R.OwnerID AND T.MemberID = R.ReportsTo AND T.ReportsTo = 1)
inner join Accounts on (Accounts.OwnerID = 109 and Accounts.AssignedTo = R.ReportsTo)
inner join Acc_ex1 on (Acc_ex1.OwnerID = 109 and Acc_ex1.Acc_ex1_Id = Accounts.AccountID and Acc_ex1.Acc_ex1_3 > '0')
inner join Acc_ex5 on (Acc_ex5.OwnerID = 109 and Acc_ex5.Acc_ex5_Id = Accounts.AccountID )
--where TerritoryID in ( select ChildRegionID RegionID from RegionWithSubRegions where OwnerID =109 and RegionID = 729)
union
select distinct R.ReportsTo as directReportingUserId, Acc_ex1_3 as GroupName, 1 as Groups,
case when Acc_ex5.Acc_ex5_92 between GETDATE()-365*10 and GETDATE() then 1 else 0 end as GroupsNotContacted
FROM ReportingMembers R
INNER JOIN TeamMembers T
ON (T.OwnerID = R.OwnerID AND T.MemberID = R.ReportsTo)
inner join Accounts on (Accounts.OwnerID = 109 and Accounts.AssignedTo = R.ReportsTo)
inner join Acc_ex1 on (Acc_ex1.OwnerID = 109 and Acc_ex1.Acc_ex1_Id = Accounts.AccountID and Acc_ex1.Acc_ex1_3 > '0')
inner join Acc_ex5 on (Acc_ex5.OwnerID = 109 and Acc_ex5.Acc_ex5_Id = Accounts.AccountID )
--where TerritoryID in ( select ChildRegionID RegionID from RegionWithSubRegions where OwnerID =109 and RegionID = 729)
where R.MemberID = 1
) GroupWiseInfo
group by directReportingUserId
) GroupInfo
on UserInfo.ReportsTo = GroupInfo.directReportingUserId
Please mark it as an answer/helpful if you find it as useful. Thanks, Satya Prakash Jugran -
Query is taking long time to execute after migrating to 10g r2
Hi
We recently migrated the database from 9i to 10gr2 ((10.2.0.2.0).. This query was running in acceptable time before the upgrade in 9i.. Now it is taking a long long time to execute this... Can you please let me know what should i do to improve the performance now.. We are running stats everyday..
Thanks for your help,
Shree
======================================================================================
SELECT cr.cash_receipt_id
,cr.pay_from_customer
,cr.receipt_number
,cr.receipt_date
,cr.amount
,cust.account_number
,crh.gl_date
,cr.set_of_books_id
,sum(ra.amount_applied) amount_applied
FROM AR_CASH_RECEIPTS_ALL cr
,AR_RECEIVABLE_APPLICATIONS_ALL ra
,hz_cust_accounts cust
,AR_CASH_RECEIPT_HISTORY_ALL crh
,GL_PERIOD_STATUSES gps
,FND_APPLICATION app
WHERE cr.cash_receipt_id = ra.cash_receipt_id
AND ra.status = 'UNAPP'
AND cr.status <> 'REV'
AND cust.cust_account_id = cr.pay_from_customer
AND substr(cust.account_number,1,2) <> 'SI' -- Don't allocate Unapplied receipts FOR SI customers
AND crh.cash_receipt_id = cr.cash_receipt_id
AND app.application_id = gps.application_id
AND app.application_short_name = 'AR'
AND gps.period_name = 'May-07'
AND crh.gl_date <= gps.end_date
AND cr.receipt_number not like 'WH%'
-- AND cust.customer_number = '0000079260001'
GROUP BY cr.cash_receipt_id
,cr.pay_from_customer
,cr.receipt_number
,cr.receipt_date
,cr.amount
,cust.account_number
,crh.gl_date
,cr.set_of_books_id
HAVING sum(ra.amount_applied) > 0;
=========================================================================================
Here is the explain plan in 10g r2 (10.2.0.2.0)
PLAN_TABLE_OUTPUT
Plan hash value: 2617075047
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
| 0 | SELECT STATEMENT | | 92340 | 10M| | 513K (1)|
|* 1 | FILTER | | | | | |
| 2 | HASH GROUP BY | | 92340 | 10M| 35M| 513K (1)|
| 3 | TABLE ACCESS BY INDEX ROWID | AR_RECEIVABLE_APPLICATIONS_ALL | 2 | 34 |
| 4 | NESTED LOOPS | | 184K| 21M| | 510K (1)|
|* 5 | HASH JOIN | | 99281 | 9M| 3296K| 176K (1)|
|* 6 | TABLE ACCESS FULL | HZ_CUST_ACCOUNTS | 112K| 1976K| | 22563 (1)|
|* 7 | HASH JOIN | | 412K| 33M| 25M| 151K (1)|
| 8 | TABLE ACCESS BY INDEX ROWID | AR_CASH_RECEIPT_HISTORY_ALL | 332K| 4546K|
| 9 | NESTED LOOPS | | 498K| 19M| | 26891 (1)|
| 10 | NESTED LOOPS | | 2 | 54 | | 4 (0)|
| 11 | TABLE ACCESS BY INDEX ROWID| FND_APPLICATION | 1 | 8 | | 1 (0)|
|* 12 | INDEX UNIQUE SCAN | FND_APPLICATION_U3 | 1 | | | 0 (0)|
| 13 | TABLE ACCESS BY INDEX ROWID| GL_PERIOD_STATUSES | 2 | 38 | | 3 (0)
|* 14 | INDEX RANGE SCAN | GL_PERIOD_STATUSES_U1 | 1 | | | 2 (0)|
|* 15 | INDEX RANGE SCAN | AR_CASH_RECEIPT_HISTORY_N2 | 332K| | | 1011 (1)
PLAN_TABLE_OUTPUT
|* 16 | TABLE ACCESS FULL | AR_CASH_RECEIPTS_ALL | 5492K| 235M| | 108K
|* 17 | INDEX RANGE SCAN | AR_RECEIVABLE_APPLICATIONS_N1 | 4 | | | 2
Predicate Information (identified by operation id):
1 - filter(SUM("RA"."AMOUNT_APPLIED")>0)
5 - access("CUST"."CUST_ACCOUNT_ID"="CR"."PAY_FROM_CUSTOMER")
6 - filter(SUBSTR("CUST"."ACCOUNT_NUMBER",1,2)<>'SI')
7 - access("CRH"."CASH_RECEIPT_ID"="CR"."CASH_RECEIPT_ID")
12 - access("APP"."APPLICATION_SHORT_NAME"='AR')
14 - access("APP"."APPLICATION_ID"="GPS"."APPLICATION_ID" AND "GPS"."PERIOD_NAME"='May-07')
filter("GPS"."PERIOD_NAME"='May-07')
15 - access("CRH"."GL_DATE"<="GPS"."END_DATE")
16 - filter("CR"."STATUS"<>'REV' AND "CR"."RECEIPT_NUMBER" NOT LIKE 'WH%')
17 - access("CR"."CASH_RECEIPT_ID"="RA"."CASH_RECEIPT_ID" AND "RA"."STATUS"='UNAPP')
filter("RA"."CASH_RECEIPT_ID" IS NOT NULL)
Here is the explain plan in 9i
Execution Plan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=445977 Card=78530 By
tes=9423600)
1 0 FILTER
2 1 SORT (GROUP BY) (Cost=445977 Card=78530 Bytes=9423600)
3 2 HASH JOIN (Cost=443717 Card=157060 Bytes=18847200)
4 3 HASH JOIN (Cost=99563 Card=94747 Bytes=9758941)
5 4 TABLE ACCESS (FULL) OF 'HZ_CUST_ACCOUNTS' (Cost=12
286 Card=110061 Bytes=1981098)
6 4 HASH JOIN (Cost=86232 Card=674761 Bytes=57354685)
7 6 TABLE ACCESS (BY INDEX ROWID) OF 'AR_CASH_RECEIP
T_HISTORY_ALL' (Cost=17532 Card=542304 Bytes=7592256)
8 7 NESTED LOOPS (Cost=17536 Card=809791 Bytes=332
01431)
9 8 NESTED LOOPS (Cost=4 Card=1 Bytes=27)
10 9 TABLE ACCESS (BY INDEX ROWID) OF 'FND_APPL
ICATION' (Cost=1 Card=1 Bytes=8)
11 10 INDEX (UNIQUE SCAN) OF 'FND_APPLICATION_
U3' (UNIQUE)
12 9 TABLE ACCESS (BY INDEX ROWID) OF 'GL_PERIO
D_STATUSES' (Cost=3 Card=1 Bytes=19)
13 12 INDEX (RANGE SCAN) OF 'GL_PERIOD_STATUSE
S_U1' (UNIQUE) (Cost=2 Card=1)
14 8 INDEX (RANGE SCAN) OF 'AR_CASH_RECEIPT_HISTO
RY_N2' (NON-UNIQUE) (Cost=1740 Card=542304)
15 6 TABLE ACCESS (FULL) OF 'AR_CASH_RECEIPTS_ALL' (C
ost=60412 Card=8969141 Bytes=394642204)
16 3 TABLE ACCESS (FULL) OF 'AR_RECEIVABLE_APPLICATIONS_A
LL' (Cost=337109 Card=15613237 Bytes=265425029)Hi,
The plan between 9i and 10g is pretty the same but the amount of data fetched has considerably increased. I guess the query was performing slow even in 9i.
The AR_CASH_RECEIPT_HISTORY_ALL is presently having 332000 rows in 10g where as it was 17532 in 9i.
AR_CASH_RECEIPT_HISTORY_N2 is now having 332,000 rows in 10g where as in 9i it had 1,740
Try creating some indexes on
AR_CASH_RECEIPTS_ALL
hz_cust_accounts -
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. -
Query started taking longer time with SQL*Net message from dblink
Hi,
Since Yesterday we started see one query which normally used to take 3 min but now it started taking 70 min after a small change do the query instead of accessing view we started accessing directly table.
Both Schema's are on same DB.
Oracle version=11.2.0.2
OS=Solaris 10
Existing Query
WITH ot_symbol_data_v AS
(SELECT dat.symbol, dat.startdate, dat.enddate, oi.currencycode,
dat.primarymarket, primsymb.symbol primarysymbol, dat.mic,
dat.universeid, dat.symbology
FROM onetick_symbol_data@refdata_link dat
LEFT JOIN
(SELECT symbology, universeid, mic, MAX (enddate) enddate
FROM onetick_symbol_data@refdata_link
GROUP BY symbology, universeid, mic) prim
ON prim.symbology = dat.symbology
AND prim.universeid = dat.universeid
AND prim.mic = dat.primarymarket
LEFT JOIN onetick_symbol_data@refdata_link primsymb
ON prim.symbology = primsymb.symbology
AND prim.universeid = primsymb.universeid
AND prim.mic = primsymb.mic
AND prim.enddate = primsymb.enddate
JOIN onetick_isincur_data@refdata_link oi
ON dat.universeid = oi.universeid
JOIN
(SELECT universeid, MAX (enddate) AS enddate
FROM onetick_isincur_data@refdata_link
GROUP BY universeid) oilatest
ON oi.universeid = oilatest.universeid
AND oi.enddate = oilatest.enddate
ORDER BY dat.universeid, dat.mic, dat.symbology, dat.enddate)
SELECT i.instrumentid
|| '||'
|| i.firsttradingdate
|| '000000|'
|| NVL (i.delisteddate, '30001231')
|| '000000|'
|| i.home_market
|| '|'
|| DECODE (imfm.feedid, 0, 'FIXN_RFA', 1, 'ALGO', 2, 'FIXNETIX')
|| '::'
|| osdv.primarysymbol
FROM tibex_meinstrumentview i JOIN tibex_instrumentmicfeedmapview imfm
ON i.isin = imfm.isin
AND i.currencycode = imfm.currencycode
AND i.home_market = imfm.mic
JOIN rd_universeview@refdata_link u
ON i.instrumentid = u.instrumentid AND i.instrumentstatus != 3
and active='Y'
JOIN
(SELECT universeid, DECODE (symbology, 1, 0, 2, 2, -1) feedid,
primarysymbol
FROM ot_symbol_data_v
GROUP BY universeid, symbology, primarysymbol) osdv
ON u.universeid = osdv.universeid
WHERE osdv.feedid = imfm.feedid
ORDER BY i.isin, i.currencycode, i.instrumentid;
New Query
WITH ot_symbol_data_v AS
(SELECT dat.symbol, dat.startdate, dat.enddate, oi.currencycode,
dat.primarymarket, primsymb.symbol primarysymbol, dat.mic,
dat.universeid, dat.symbology
FROM onetick_symbol_data@refdata_link dat
LEFT JOIN
(SELECT symbology, universeid, mic, MAX (enddate) enddate
FROM onetick_symbol_data@refdata_link
GROUP BY symbology, universeid, mic) prim
ON prim.symbology = dat.symbology
AND prim.universeid = dat.universeid
AND prim.mic = dat.primarymarket
LEFT JOIN onetick_symbol_data@refdata_link primsymb
ON prim.symbology = primsymb.symbology
AND prim.universeid = primsymb.universeid
AND prim.mic = primsymb.mic
AND prim.enddate = primsymb.enddate
JOIN onetick_isincur_data@refdata_link oi
ON dat.universeid = oi.universeid
JOIN
(SELECT universeid, MAX (enddate) AS enddate
FROM onetick_isincur_data@refdata_link
GROUP BY universeid) oilatest
ON oi.universeid = oilatest.universeid
AND oi.enddate = oilatest.enddate
ORDER BY dat.universeid, dat.mic, dat.symbology, dat.enddate)
SELECT i.instrumentid
|| '||'
|| i.firsttradingdate
|| '000000|'
|| NVL (i.delisteddate, '30001231')
|| '000000|'
|| i.home_market
|| '|'
|| DECODE (imfm.feedid, 0, 'FIXN_RFA', 1, 'ALGO', 2, 'FIXNETIX')
|| '::'
|| osdv.primarysymbol
FROM tibex_meinstrumentview i JOIN tibex_instrumentmicfeedmapview imfm
ON i.isin = imfm.isin
AND i.currencycode = imfm.currencycode
AND i.home_market = imfm.mic
JOIN universe@refdata_link u
ON i.instrumentid = u.instrumentid AND i.instrumentstatus != 3
and active='Y'
JOIN
(SELECT universeid, DECODE (symbology, 1, 0, 2, 2, -1) feedid,
primarysymbol
FROM ot_symbol_data_v
GROUP BY universeid, symbology, primarysymbol) osdv
ON u.universeid = osdv.universeid
WHERE osdv.feedid = imfm.feedid
ORDER BY i.isin, i.currencycode, i.instrumentid;Most of the wait event is
SQL*Net message from dblink
SQL*Net message to dblink
Regards
NMHi Kim,
uat_trd_owner@UAT001> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 741667790
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Inst |IN-OUT|
| 0 | SELECT STATEMENT | | 1 | 137 | 21981 (2)| 00:04:24 | | |
| 1 | SORT ORDER BY | | 1 | 137 | 21981 (2)| 00:04:24 | | |
|* 2 | HASH JOIN OUTER | | 1 | 137 | 21980 (2)| 00:04:24 | | |
|* 3 | HASH JOIN OUTER | | 1 | 131 | 422 (4)| 00:00:06 | | |
| 4 | NESTED LOOPS | | | | | | | |
| 5 | NESTED LOOPS | | 1 | 125 | 107 (9)| 00:00:02 | | |
| 6 | NESTED LOOPS | | 20 | 1680 | 87 (11)| 00:00:02 | | |
|* 7 | HASH JOIN | | 1 | 64 | 86 (11)| 00:00:02 | | |
| 8 | VIEW | TIBEX_INSTRUMENTMICFEEDMAPVIEW | 1 | 34 | 84 (9)| 00:00:02 | | |
| 9 | HASH GROUP BY | | 1 | 166 | 84 (9)| 00:00:02 | | |
|* 10 | HASH JOIN RIGHT OUTER | | 267 | 44322 | 83 (8)| 00:00:01 | | |
| 11 | TABLE ACCESS FULL | TIBEX_BOARDFEEDMAP | 1 | 20 | 3 (0)| 00:00:01 | | |
| 12 | NESTED LOOPS OUTER | | 267 | 38982 | 80 (8)| 00:00:01 | | |
| 13 | NESTED LOOPS OUTER | | 267 | 21627 | 80 (8)| 00:00:01 | | |
|* 14 | HASH JOIN | | 267 | 17088 | 80 (8)| 00:00:01 | | |
| 15 | MERGE JOIN CARTESIAN | | 2004 | 88176 | 37 (0)| 00:00:01 | | |
| 16 | INDEX FULL SCAN | TIBEX_EDPDEFAULTFEED_PK | 1 | 3 | 1 (0)| 00:00:01 | | |
| 17 | BUFFER SORT | | 2004 | 82164 | 36 (0)| 00:00:01 | | |
|* 18 | TABLE ACCESS FULL | TIBEX_INSTRUMENT | 2004 | 82164 | 36 (0)| 00:00:01 | | |
| 19 | VIEW | TIBEX_EDPINSTRUMENTMARKETSVIEW | 22040 | 430K| 42 (12)| 00:00:01 | | |
| 20 | HASH GROUP BY | | 22040 | 430K| 42 (12)| 00:00:01 | | |
| 21 | VIEW | | 22040 | 430K| 41 (10)| 00:00:01 | | |
| 22 | SORT UNIQUE | | 22040 | 544K| 41 (57)| 00:00:01 | | |
| 23 | UNION-ALL | | | | | | | |
| 24 | INDEX FAST FULL SCAN| TIBEX_EDPFIXNETIXL1_R01 | 7578 | 162K| 18 (0)| 00:00:01 | | |
| 25 | TABLE ACCESS FULL | TIBEX_EDPIXSYMBOLS | 7494 | 197K| 12 (0)| 00:00:01 | | |
| 26 | TABLE ACCESS FULL | TIBEX_EDPRFALGOSUBSCRIPTION | 6968 | 183K| 7 (0)| 00:00:01 | | |
|* 27 | INDEX RANGE SCAN | TIBEX_MICFEEDMAP_PK | 1 | 17 | 0 (0)| 00:00:01 | | |
| 28 | TABLE ACCESS BY INDEX ROWID| TIBEX_INSTRUMENTFEEDMAP | 1 | 65 | 0 (0)| 00:00:01 | | |
|* 29 | INDEX UNIQUE SCAN | TIBEX_INSTRUMENTFEEDMAP_PK | 1 | | 0 (0)| 00:00:01 | | |
| 30 | VIEW | | 100 | 3000 | 1 (100)| 00:00:01 | | |
| 31 | REMOTE | | | | | | REFDA~ | R->S |
| 32 | REMOTE | UNIVERSE | 20 | 400 | 1 (0)| 00:00:01 | REFDA~ | R->S |
|* 33 | INDEX UNIQUE SCAN | XPKTIBEX_INSTRUMENT | 1 | | 0 (0)| 00:00:01 | | |
|* 34 | TABLE ACCESS BY INDEX ROWID | TIBEX_INSTRUMENT | 1 | 41 | 1 (0)| 00:00:01 | | |
| 35 | VIEW | TIBEX_MELASTEXPRICEINTVIEW | 36 | 216 | 314 (2)| 00:00:04 | | |
| 36 | HASH UNIQUE | | 36 | 1656 | 314 (2)| 00:00:04 | | |
|* 37 | HASH JOIN | | 36 | 1656 | 313 (1)| 00:00:04 | | |
| 38 | VIEW | VW_SQ_1 | 304 | 5776 | 157 (2)| 00:00:02 | | |
| 39 | HASH GROUP BY | | 304 | 7296 | 157 (2)| 00:00:02 | | |
|* 40 | TABLE ACCESS FULL | TIBEX_EXECUTION | 17462 | 409K| 156 (1)| 00:00:02 | | |
| 41 | TABLE ACCESS FULL | TIBEX_EXECUTION | 17463 | 460K| 156 (1)| 00:00:02 | | |
| 42 | VIEW | TIBEX_MSGSEQBYINSTRUMENT | 3908 | 23448 | 21558 (2)| 00:04:19 | | |
| 43 | HASH GROUP BY | | 3908 | 74252 | 21558 (2)| 00:04:19 | | |
| 44 | VIEW | | 11626 | 215K| 21556 (2)| 00:04:19 | | |
| 45 | UNION-ALL | | | | | | | |
| 46 | HASH GROUP BY | | 1460 | 26280 | 8906 (1)| 00:01:47 | | |
| 47 | TABLE ACCESS FULL | TIBEX_QUOTE | 1362K| 23M| 8866 (1)| 00:01:47 | | |
| 48 | HASH GROUP BY | | 677 | 12186 | 11750 (2)| 00:02:21 | | |
| 49 | TABLE ACCESS FULL | TIBEX_ORDER | 1790K| 30M| 11696 (1)| 00:02:21 | | |
| 50 | HASH GROUP BY | | 304 | 5472 | 157 (2)| 00:00:02 | | |
|* 51 | TABLE ACCESS FULL | TIBEX_EXECUTION | 17463 | 306K| 156 (1)| 00:00:02 | | |
| 52 | HASH GROUP BY | | 1 | 40 | 3 (34)| 00:00:01 | | |
|* 53 | TABLE ACCESS FULL | TIBEX_TSTRADE | 1 | 40 | 2 (0)| 00:00:01 | | |
| 54 | HASH GROUP BY | | 717 | 11472 | 229 (1)| 00:00:03 | | |
| 55 | INDEX FAST FULL SCAN | IX_BESTEXREL | 7323 | 114K| 228 (0)| 00:00:03 | | |
| 56 | HASH GROUP BY | | 1911 | 34398 | 13 (8)| 00:00:01 | | |
|* 57 | TABLE ACCESS FULL | TIBEX_MERESUMEPRDTRANSITION | 5216 | 93888 | 12 (0)| 00:00:01 | | |
PLAN_TABLE_OUTPUT
| 58 | HASH GROUP BY | | 3 | 51 | 5 (20)| 00:00:01 | | |
| 59 | TABLE ACCESS FULL | TIBEX_EDPUPDATEREJECT | 48 | 816 | 4 (0)| 00:00:01 | | |
| 60 | HASH GROUP BY | | 1587 | 46023 | 215 (2)| 00:00:03 | | |
|* 61 | HASH JOIN | | 35166 | 995K| 213 (1)| 00:00:03 | | |
| 62 | INDEX FULL SCAN | XPKTIBEX_CONFIGMEGROUP | 4 | 16 | 1 (0)| 00:00:01 | | |
| 63 | TABLE ACCESS FULL | TIBEX_INSTRUMENTADMIN | 87915 | 2146K| 212 (1)| 00:00:03 | | |
| 64 | HASH GROUP BY | | 6 | 102 | 5 (20)| 00:00:01 | | |
| 65 | TABLE ACCESS FULL | TIBEX_BESTEXECPRICELOG | 793 | 13481 | 4 (0)| 00:00:01 | | |
| 66 | HASH GROUP BY | | 1 | 40 | 3 (34)| 00:00:01 | | |
|* 67 | TABLE ACCESS FULL | TIBEX_AUCTIONPRICE | 1 | 40 | 2 (0)| 00:00:01 | | |
| 68 | HASH GROUP BY | | 1587 | 28566 | 236 (2)| 00:00:03 | | |
|* 69 | TABLE ACCESS FULL | TIBEX_ADMINACK | 87915 | 1545K| 233 (1)| 00:00:03 | | |
| 70 | HASH GROUP BY | | 1914 | 34452 | 26 (8)| 00:00:01 | | |
| 71 | INDEX FAST FULL SCAN | INSTRUMENTSTATEMSGSEQ | 23705 | 416K| 24 (0)| 00:00:01 | | |
| 72 | HASH GROUP BY | | 1458 | 26244 | 8 (13)| 00:00:01 | | |
| 73 | INDEX FAST FULL SCAN | TIBEX_FREEZEEOTPK | 5890 | 103K| 7 (0)| 00:00:01 | | |
Predicate Information (identified by operation id):
2 - access("A"."INSTRUMENTID"="C"."INSTRUMENTID"(+))
3 - access("A"."INSTRUMENTID"="B"."INSTRUMENTID"(+))
7 - access("OSDV"."FEEDID"="IMFM"."FEEDID")
10 - access("I"."PRIMARYSTATUSBOARDID"="BOARDFM"."BOARDID"(+))
14 - access("SUBSC"."ISIN"="I"."ISIN" AND "SUBSC"."CURRENCYCODE"="I"."CURRENCYCODE")
filter("SUBSC"."HOMEMARKET" IS NULL OR "SUBSC"."HOMEMARKET"="I"."HOME_MARKET")
18 - filter("I"."INSTRUMENTSTATUS"<>3)
27 - access("SUBSC"."MIC"="MICFM"."MIC"(+))
29 - access("I"."INSTRUMENTID"="INSTRFM"."INSTRUMENTID"(+))
33 - access("A"."INSTRUMENTID"="U"."INSTRUMENTID")
34 - filter("A"."INSTRUMENTSTATUS"<>3 AND TO_DATE("A"."FIRSTTRADINGDATE",'YYYYMMDD')<=SYSDATE@! AND "A"."ISIN"="IMFM"."ISIN"
AND "A"."CURRENCYCODE"="IMFM"."CURRENCYCODE" AND "A"."HOME_MARKET"="IMFM"."MIC")
37 - access("A"."MESSAGESEQUENCE"="MAX(B.MESSAGESEQUENCE)" AND "A"."INSTRUMENTID"="ITEM_0")
40 - filter(("B"."SELLENTITYTYPE"=0 OR "B"."SELLENTITYTYPE"=2) AND ("B"."BUYENTITYTYPE"=0 OR "B"."BUYENTITYTYPE"=2))
51 - filter("INSTRUMENTID" IS NOT NULL)
53 - filter("INSTRUMENTID" IS NOT NULL)
57 - filter("INSTRUMENTID" IS NOT NULL)
61 - access("ADMINUSER"="MEGROUPID")
67 - filter("INSTRUMENTID" IS NOT NULL)
69 - filter("INSTRUMENTID" IS NOT NULL)
Remote SQL Information (identified by operation id):
31 - EXPLAIN PLAN INTO PLAN_TABLE@! FOR SELECT "A1"."UNIVERSEID",DECODE("A1"."SYMBOLOGY",1,0,2,2,(-1)),"A1"."PRIMARYSYMBOL"
FROM (SELECT "A6"."SYMBOL" "SYMBOL","A6"."STARTDATE" "STARTDATE","A6"."ENDDATE" "ENDDATE","A3"."CURRENCYCODE"
"CURRENCYCODE","A6"."PRIMARYMARKET" "PRIMARYMARKET","A4"."SYMBOL" "PRIMARYSYMBOL","A6"."MIC" "MIC","A6"."UNIVERSEID"
"UNIVERSEID","A6"."SYMBOLOGY" "SYMBOLOGY" FROM "ONETICK_SYMBOL_DATA" "A6", (SELECT "A7"."SYMBOLOGY"
"SYMBOLOGY","A7"."UNIVERSEID" "UNIVERSEID","A7"."MIC" "MIC",MAX("A7"."ENDDATE") "ENDDATE" FROM "ONETICK_SYMBOL_DATA" "A7" GROUP
BY "A7"."SYMBOLOGY","A7"."UNIVERSEID","A7"."MIC") "A5","ONETICK_SYMBOL_DATA" "A4","ONETICK_ISINCUR_DATA" "A3", (SELECT
"A8"."UNIVERSEID" "UNIVERSEID",MAX("A8"."ENDDATE") "ENDDATE" FROM "ONETICK_ISINCUR_DATA" "A8" GROUP BY "A8"."UNIVERSEID") "A2"
WHERE "A3"."UNIVERSEID"="A2"."UNIVERSEID" AND "A3"."ENDDATE"="A2"."ENDDATE" AND "A6"."UNIVERSEID"="A3"."UNIVERSEID" AND
"A5"."ENDDATE"="A4"."ENDDATE"(+) AND "A5"."MIC"="A4"."MIC"(+) AND "A5"."UNIVERSEID"="A4"."UNIVERSEID"(+) AND
"A5"."SYMBOLOGY"="A4"."SYMBOLOGY"(+) AND "A5"."MIC"(+)="A6"."PRIMARYMARKET" AND "A5"."UNIVERSEID"(+)="A6"."UNIVERSEID" AND
"A5"."SYMBOLOGY"(+)="A6"."SYMBOLOGY" ORDER BY "A6"."UNIVERSEID","A6"."MIC","A6"."SYMBOLOGY","A6"."ENDDATE") "A1" GROUP BY
"A1"."UNIVERSEID","A1"."SYMBOLOGY","A1"."PRIMARYSYMBOL" (accessing 'REFDATA_LINK' )
32 - SELECT "INSTRUMENTID","UNIVERSEID" FROM "UNIVERSE" "U" WHERE "UNIVERSEID"=:1 (accessing 'REFDATA_LINK' )
127 rows selected.
For trace files
WAIT #18446741324892119016: nam='SQL*Net message to client' ela= 2 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151855125079
WAIT #18446741324892119016: nam='SQL*Net message from client' ela= 182 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151855125694
=====================
PARSING IN CURSOR #18446741324892117968 len=52 dep=0 uid=474 oct=47 lid=474 tim=42151855125777 hv=1029988163 ad='af4d0890' sqlid='9babjv8yq8ru3'
BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
END OF STMT
PARSE #18446741324892117968:c=0,e=42,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=0,tim=42151855125769
WAIT #18446741324892117968: nam='SQL*Net message to client' ela= 2 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151855126145
EXEC #18446741324892117968:c=0,e=262,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=0,tim=42151855126176
*** 2012-11-20 15:18:56.839
WAIT #18446741324892117968: nam='SQL*Net message from client' ela= 10252982 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151865379208
CLOSE #18446741324892119016:c=0,e=13,dep=0,type=1,tim=42151865379327
CLOSE #18446741324892117968:c=0,e=28,dep=0,type=3,tim=42151865379370
WAIT #18446741324892082152: nam='single-task message' ela= 47849 p1=0 p2=0 p3=0 obj#=-1 tim=42151865429221
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 107 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151865429886
WAIT #18446741324892082152: nam='SQL*Net message to dblink' ela= 2 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151865429945
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 926 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151865430901
WAIT #18446741324892082152: nam='SQL*Net message to dblink' ela= 2 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151865431578
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 2525 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151865434125
WAIT #18446741324892082152: nam='SQL*Net message to dblink' ela= 1 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670108
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 58 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670178
WAIT #18446741324892082152: nam='SQL*Net message to dblink' ela= 0 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670235
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 60 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670310
WAIT #18446741324892082152: nam='SQL*Net message to dblink' ela= 1 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670337
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 59 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670407
WAIT #18446741324892082152: nam='SQL*Net message to dblink' ela= 0 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670464
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 60 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670539
WAIT #18446741324892082152: nam='SQL*Net message to dblink' ela= 1 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670566
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 59 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670636
WAIT #18446741324892082152: nam='SQL*Net message to dblink' ela= 1 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670693
WAIT #18446741324892082152: nam='SQL*Net message from dblink' ela= 60 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=42151894670768Regards
NM -
SQL execution taking long time
All,
I have a read only VO and i have configured the VO to print the SQL getting executed along with bind parameters. The SQL is taking a lot of time to execute when running in web. When i run the generated SQL in toad it takes close to 30.6 seconds, however on the page it is taking closed to 5 mins. In the logs i can see the sql getting printed, then the bind variable and then it stops for around 5-8 mins then proceeds.
Also my query fetches a max of 10 records in worst case else 2-3 always so i guess setting of range size is not going to work.
Any idea as to what is wrong in my case.
thnks
Jdev 11.1.1.5Hi,
Do your query use index, if so then check that your binds have the same data type as columns in where clause and you don't do like
where upper(column_name) = :upper(bind1) -
Query regarding the ActiveSync and parameter time-taken from ActiveSync IIS logs.
Here what I see for from the logs.
[email protected] 45.101.90.185 Apple-iPad2C3/1202.410 200 0 0 1501129
443 [email protected] 45.101.90.185 Apple-iPad2C3/1202.410 200
0 0 22105
443 [email protected] 45.101.90.185 Apple-iPad2C3/1202.410 200
0 0 452
443 [email protected] 45.101.90.185 Apple-iPad2C3/1202.410 200
0 0 936
443 [email protected] 45.101.90.185 Apple-iPad2C3/1202.410 200
0 0 656238
In the above log, highlighted are the time-taken and I just want to check what is the ideal time-taken value, some value above should be causing some problem, like the one of the top 1501129 ?
?AND I see its for POST event and CMD=Ping&log query.......
We have Mobile Iron in the environment and we are seeing few timeout errors on MobileIron server and for users intermittently. They usually see below error... However we don't see any end users issues, but just want to get rid of below error. MobileIron guys
are pointing it to time-taken value which is high intermittently.
IOException connection to server [email protected] -- java.io.IOException:
awaitUninterruptibly was stopped by timeout
@BALAHi,
To understand more about the issue, I’d like to confirm the following information:
1. What’s your Exchange 2010 version?
http://support.microsoft.com/kb/2536517/en-us
2. Do you install other software, like SQL, on the same Exchange Server?
3. Change another admin account to access EMS.
Thanks,
Angela Shi
TechNet Community Support -
BEA query is taking long time to run
Hi All,
I am using BEA Weblogic 10.2. I am performing seraching in the repository.
The query string is:
cm_lifeCycleStatus==4&&SERVICE == 'RBT' &©RIGHTTO >= toDate('yyyy-MM-dd', '2010-07-01')&©RIGHTFROM <= toDate('yyyy-MM-dd', '2010-07-01')
Here SERVICE,COPYRIGHTTO,COPYRIGHTFROM are the property.
If i am using cm_midifiedDate instead of COPYRIGHTTO,COPYRIGHTFROM , it giving result very fast.
But the the need is to use COPYRIGHTTO,COPYRIGHTFROM .
Please suggest me how can i optimize this query.
The code to fecth is:
ctx = new ContentContext(this.getRequest());
IVersionManager ivm = ContentManagerFactory.getVersionManager();
Expression exp = ExpressionHelper.parse(query);
Search search = new Search();
search.setExpression(exp);
search.setFullTextSearch(false);
nodeList = ivm.search(ctx, search);
Thnaks
ArvindI'm not completely sure that the Version tables have indices that are optimized for query performance. Based on your original post, I'm assuming that you are eventually getting the correct results back but it just takes too long? You might want to do some database diagnostics to see how the query is being executed and if any index is being consulted. I would assume not and that is where your performance issue might be coming from. The published content tables (such as CM_NODE) are optimized for query response.
Explicit properties only apply to the Published CM_NODE table. To do this, you'd add a column to the CM_NODE database table, ensure that the datatype on the column matches your desired Property data type. Then, in your Content Type definition, in the Portal Admin, you'd mark the "Is Explicit" attribute on the Property and enter the name of the database column which you created to store the values. Of course, in the database, you'd probably want to create an index on this new column to make it faster for searching.
Brad -
Query execution takes long time
Hi All,
I have one critical problem in my production system.
I have three sales related queries in the production system and when i try to execute it in the BEx analyser(in Microsoft excle) it will take too much time and at last it will give am error that "Time Limit Exceeded" .
Actually we have created these three queries on one Infoset and that Infoset contains three DSOs and two master data.
Please give me the proper solution and help me to solve this production problem.Dear James,
first give some filter conditions on the query and try to restrict for lesser volume of data.from the message it is evident that may be you are trying to fetch large volume of data.so please execute the query once in RSRT and try to find the solution in that.there you can get all the statistics reagrding the query.if still you cant find please let me know the message you are getting in RSRT.then we can give a viable solution for that.
hope you might aware of all the options reagarding RSRT.
assign points if it helps..
Thanks & Regards,
Ashok. -
View query execution taking more time
hi all,
what would be the reason that my event view is still not getting executed for around 24 hours.
actually i created 2 event views one is like ora1 and another is like ora1_1 both are having the same data.
the first view ora1 executed by 14 hours.
but my second view still not get executed it is still running for last 30 hours.
very urgent.
plz tell me the reason for the delay
and if possible provide me a solution too
thanks in advance
sureshDear sir,
Please find the Scripts & Explain Plan for the Scripts in the attachment (ABC.zip)
ABCReports51_new.sql - Fetching values from EVENT_T_VIEW
ABCReports51_new_1.sql - Fetching values from EVENT_T
create_event_view.sql - Command executed to create EVENT_T_VIEW
ExplainPlan4event_t.txt - Explain Plan for the Query fetching values from event_t table
ExplainPlan4event_t_view.txt - Explain Plan for the Query fetching values from event_t_view
indexed_columns.txt - Indexed columns in event_t
TableDesc.txt - Table description for event_t, event_bal_impacts_t, event_session_dialup_t
SQL> desc event_bal_impacts_t;
Name Null? Type
OBJ_ID0 NUMBER(38)
REC_ID NUMBER(38)
ACCOUNT_OBJ_DB NUMBER(38)
ACCOUNT_OBJ_ID0 NUMBER(38)
ACCOUNT_OBJ_TYPE VARCHAR2(255)
ACCOUNT_OBJ_REV NUMBER(38)
AMOUNT NUMBER
AMOUNT_DEFERRED NUMBER
AMOUNT_ORIG NUMBER
DISCOUNT NUMBER
GL_ID NUMBER(38)
IMPACT_CATEGORY VARCHAR2(255)
IMPACT_TYPE NUMBER(38)
ITEM_OBJ_DB NUMBER(38)
ITEM_OBJ_ID0 NUMBER(38)
ITEM_OBJ_TYPE VARCHAR2(255)
ITEM_OBJ_REV NUMBER(38)
PERCENT NUMBER
PRODUCT_OBJ_DB NUMBER(38)
PRODUCT_OBJ_ID0 NUMBER(38)
PRODUCT_OBJ_TYPE VARCHAR2(255)
PRODUCT_OBJ_REV NUMBER(38)
QUANTITY NUMBER
RATE_OBJ_DB NUMBER(38)
RATE_OBJ_ID0 NUMBER(38)
RATE_OBJ_TYPE VARCHAR2(255)
RATE_OBJ_REV NUMBER(38)
RATE_TAG VARCHAR2(255)
RESOURCE_ID NUMBER(38)
RESOURCE_ID_ORIG NUMBER(38)
TAX_CODE VARCHAR2(255)
NODE_LOCATION VARCHAR2(255)
LINEAGE VARCHAR2(255)
SQL> desc event_session_dialup_t;
Name Null? Type
OBJ_ID0 NUMBER(38)
ANI VARCHAR2(120)
BYTES_IN NUMBER(38)
BYTES_OUT NUMBER(38)
DESCR VARCHAR2(255)
DNIS VARCHAR2(60)
IPADDR RAW(30)
LOGIN VARCHAR2(255)
NETWORK VARCHAR2(30)
PACKETS_IN NUMBER(38)
PACKETS_OUT NUMBER(38)
SPEED NUMBER(38)
STATUS NUMBER(38)
TERM_CAUSE NUMBER(38)
TERMSERV_ID VARCHAR2(60)
TERMSERV_PORT VARCHAR2(60)
TIMEZONE NUMBER(38)
TRANS_ID VARCHAR2(60)
TYPE NUMBER(38)
UNITS NUMBER(38)
SQL> desc event_t;
Name Null? Type
POID_DB NUMBER(38)
POID_ID0 NUMBER(38)
POID_TYPE VARCHAR2(255)
POID_REV NUMBER(38)
CREATED_T NUMBER(38)
MOD_T NUMBER(38)
READ_ACCESS VARCHAR2(1)
WRITE_ACCESS VARCHAR2(1)
ACCOUNT_OBJ_DB NUMBER(38)
ACCOUNT_OBJ_ID0 NUMBER(38)
ACCOUNT_OBJ_TYPE VARCHAR2(255)
ACCOUNT_OBJ_REV NUMBER(38)
ARCHIVE_STATUS NUMBER(38)
CURRENCY NUMBER(38)
DESCR VARCHAR2(255)
EFFECTIVE_T NUMBER(38)
END_T NUMBER(38)
EARNED_START_T NUMBER(38)
EARNED_END_T NUMBER(38)
EARNED_TYPE NUMBER(38)
EVENT_NO VARCHAR2(60)
FLAGS NUMBER(38)
GROUP_OBJ_DB NUMBER(38)
GROUP_OBJ_ID0 NUMBER(38)
GROUP_OBJ_TYPE VARCHAR2(255)
GROUP_OBJ_REV NUMBER(38)
ITEM_OBJ_DB NUMBER(38)
ITEM_OBJ_ID0 NUMBER(38)
ITEM_OBJ_TYPE VARCHAR2(255)
ITEM_OBJ_REV NUMBER(38)
NAME VARCHAR2(255)
PROGRAM_NAME VARCHAR2(60)
PROVIDER_DESCR VARCHAR2(255)
PROVIDER_ID_DB NUMBER(38)
PROVIDER_ID_ID0 NUMBER(38)
PROVIDER_ID_TYPE VARCHAR2(255)
PROVIDER_ID_REV NUMBER(38)
PROVIDER_IPADDR RAW(30)
RUM_NAME VARCHAR2(255)
TOD_MODE NUMBER(38)
TIMEZONE_MODE NUMBER(38)
MIN_QUANTITY NUMBER
MIN_UNIT NUMBER(38)
INCR_QUANTITY NUMBER
INCR_UNIT NUMBER(38)
ROUNDING_MODE NUMBER(38)
NET_QUANTITY NUMBER
UNRATED_QUANTITY NUMBER
SERVICE_OBJ_DB NUMBER(38)
SERVICE_OBJ_ID0 NUMBER(38)
SERVICE_OBJ_TYPE VARCHAR2(255)
SERVICE_OBJ_REV NUMBER(38)
SESSION_OBJ_DB NUMBER(38)
SESSION_OBJ_ID0 NUMBER(38)
SESSION_OBJ_TYPE VARCHAR2(255)
SESSION_OBJ_REV NUMBER(38)
START_T NUMBER(38)
SYS_DESCR VARCHAR2(255)
TAX_LOCALES VARCHAR2(1024)
TAX_SUPPLIER_ID_DB NUMBER(38)
TAX_SUPPLIER_ID_ID0 NUMBER(38)
TAX_SUPPLIER_ID_TYPE VARCHAR2(255)
TAX_SUPPLIER_ID_REV NUMBER(38)
USERID_DB NUMBER(38)
USERID_ID0 NUMBER(38)
USERID_TYPE VARCHAR2(255)
USERID_REV NUMBER(38)
INVOICE_DATA VARCHAR2(4000)
RATED_TIMEZONE_ID VARCHAR2(64)
TIMEZONE_ADJ_START_T NUMBER(38)
TIMEZONE_ADJ_END_T NUMBER(38)
TIMEZONE_ID VARCHAR2(64)
UNIT NUMBER(38)
RERATE_OBJ_DB NUMBER(38)
RERATE_OBJ_ID0 NUMBER(38)
RERATE_OBJ_TYPE VARCHAR2(255)
RERATE_OBJ_REV NUMBER(38)
select index_name, column_name, column_position from all_ind_columns where table_name like upper('event_t')
INDEX_NAME COLUMN_NAME COLUMN_POSITION
I_EVENT_CREATED_T CREATED_T 1
I_EVENT_EVENT__NO EVENT_NO 1
I_EVENT_ITEM_OBJ__ID ITEM_OBJ_ID0 1
I_EVENT_NDX CREATED_T 1
I_EVENT_NDX POID_ID0 2
I_EVENT_PROVIDER__ID PROVIDER_ID_ID0 1
I_EVENT__ACCTOBJ_END_T ACCOUNT_OBJ_ID0 1
I_EVENT__ACCTOBJ_END_T END_T 2
I_EVENT__END_T END_T 1
I_EVENT__ID POID_ID0 1
I_EVENT__SERVOBJ_END_T SERVICE_OBJ_ID0 1
I_EVENT__SERVOBJ_END_T END_T 2
explain plan for select 'Technical Building' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(20060101000000) and date2unix(20060501000000) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.21','62.231.255.22','62.231.255.23','62.231.255.24','62.231.255.25','62.231.255.26','62.231.255.27','62.231.255.28','62.231.255.29','62.231.255.30','62.231.255.31','62.231.255.32','62.231.255.33','62.231.255.34','62.231.255.35','62.231.255.36','62.231.255.37','62.231.255.38','62.231.255.39','62.231.255.40','62.231.255.43','62.231.255.44','62.231.255.255','ADSL-7301-Test','AKO2_ERX700','AZA1_ERX700','GHA1_ERX700','GMU4_ERX700','HMR1_ERX700','HMSQ_ERX700','KWR1_ERX700','MUS','MUS1_ERX700','MUT','MUT1_ERX700','MUTRAH-ERX','OMAN-ADSL-Test','QUR2_ERX700','Qur','SEB2_ERX700','TECH_BLDG','WAT1_ERX700','WKB1_ERX700','azaiba','TB-C10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
select
substr (lpad(' ', level-1) || operation || ' (' || options || ')',1,30 ) "Operation",
object_name "Object",
partition_start, partition_stop
from
plan_table
start with id = 0
connect by prior id=parent_id;
Operation Object PARTITION_START PARTITION_STOP
SELECT STATEMENT ()
SORT (AGGREGATE)
FILTER ()
NESTED LOOPS ()
NESTED LOOPS ()
PARTITION RANGE (ALL) 1 41
TABLE ACCESS (BY LOCAL I EVENT_T 1 41
INDEX (RANGE SCAN) I_EVENT__END_T 1 41
PARTITION RANGE (ITERATOR KEY KEY
TABLE ACCESS (BY LOCAL I EVENT_BAL_IMPACTS_T KEY KEY
INDEX (RANGE SCAN) I_EVENT_BAL_IMPACTS__ID KEY KEY
PARTITION RANGE (ITERATOR) KEY KEY
TABLE ACCESS (BY LOCAL IN EVENT_SESSION_DIALUP_T KEY KEY
INDEX (UNIQUE SCAN) I_EVENT_SESSION_DIALUP__ID KEY KEY
TABLE ACCESS (FULL) PRODUCT_T
explain plan for select 'Technical Building' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(20060101000000) and date2unix(20060501000000) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.21','62.231.255.22','62.231.255.23','62.231.255.24','62.231.255.25','62.231.255.26','62.231.255.27','62.231.255.28','62.231.255.29','62.231.255.30','62.231.255.31','62.231.255.32','62.231.255.33','62.231.255.34','62.231.255.35','62.231.255.36','62.231.255.37','62.231.255.38','62.231.255.39','62.231.255.40','62.231.255.43','62.231.255.44','62.231.255.255','ADSL-7301-Test','AKO2_ERX700','AZA1_ERX700','GHA1_ERX700','GMU4_ERX700','HMR1_ERX700','HMSQ_ERX700','KWR1_ERX700','MUS','MUS1_ERX700','MUT','MUT1_ERX700','MUTRAH-ERX','OMAN-ADSL-Test','QUR2_ERX700','Qur','SEB2_ERX700','TECH_BLDG','WAT1_ERX700','WKB1_ERX700','azaiba','TB-C10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
select
substr (lpad(' ', level-1) || operation || ' (' || options || ')',1,30 ) "Operation",
object_name "Object",
partition_start, partition_stop
from
plan_table
start with id = 0
connect by prior id=parent_id;
Operation Object PARTITION_START PARTITION_STOP
SELECT STATEMENT ()
SORT (AGGREGATE)
FILTER ()
NESTED LOOPS ()
NESTED LOOPS ()
PARTITION RANGE (ALL) 1 41
TABLE ACCESS (BY LOCAL I EVENT_T 1 41
INDEX (RANGE SCAN) I_EVENT__END_T 1 41
PARTITION RANGE (ITERATOR KEY KEY
TABLE ACCESS (BY LOCAL I EVENT_BAL_IMPACTS_T KEY KEY
INDEX (RANGE SCAN) I_EVENT_BAL_IMPACTS__ID KEY KEY
PARTITION RANGE (ITERATOR) KEY KEY
TABLE ACCESS (BY LOCAL IN EVENT_SESSION_DIALUP_T KEY KEY
INDEX (UNIQUE SCAN) I_EVENT_SESSION_DIALUP__ID KEY KEY
TABLE ACCESS (FULL) PRODUCT_T
spool create_event_view.lst
set timing on
create view event_t_view as (select * from event_t where end_t between date2unix('20060701000000') and date2unix('20061001000000'))
spool off
set serveroutput on size 1000000
set timing on
set linesize 132
spool ABCReports51_new_1.lst
declare
m_report_year number(8);
v_start varchar(38);
v_end varchar(38);
-- Fetch all Session Events for Non CyberCafe (Only IP Service) Product Events
cursor SessionUsagePOP1(v_start varchar, v_end varchar) is
select 'Technical Building' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.21','62.231.255.22','62.231.255.23','62.231.255.24','62.231.255.25','62.231.255.26','62.231.255.27','62.231.255.28','62.231.255.29','62.231.255.30','62.231.255.31','62.231.255.32','62.231.255.33','62.231.255.34','62.231.255.35','62.231.255.36','62.231.255.37','62.231.255.38','62.231.255.39','62.231.255.40','62.231.255.43','62.231.255.44','62.231.255.255','ADSL-7301-Test','AKO2_ERX700','AZA1_ERX700','GHA1_ERX700','GMU4_ERX700','HMR1_ERX700','HMSQ_ERX700','KWR1_ERX700','MUS','MUS1_ERX700','MUT','MUT1_ERX700','MUTRAH-ERX','OMAN-ADSL-Test','QUR2_ERX700','Qur','SEB2_ERX700','TECH_BLDG','WAT1_ERX700','WKB1_ERX700','azaiba','TB-C10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP2(v_start varchar, v_end varchar) is
select 'Training Center' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.224','62.231.255.225','62.231.255.226','62.231.255.227','62.231.255.228','TRG-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP3(v_start varchar, v_end varchar) is
select 'Al-Khuwair' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.208') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP4(v_start varchar, v_end varchar) is
select 'Sallalah' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.192.20','62.231.192.21','62.231.192.22','62.231.255.132','62.231.255.133','62.231.255.134','SAL-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP5(v_start varchar, v_end varchar) is
select 'Sohar' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.200.20','62.231.200.21','62.231.255.148','62.231.255.149','SOH-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP6(v_start varchar, v_end varchar) is
select 'Nizwa' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.216.20','62.231.255.180','62.231.255.181','NIZ-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP7(v_start varchar, v_end varchar) is
select 'Masirah' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('212.72.13.41') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP8(v_start varchar, v_end varchar) is
select 'Ibri' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.224.20') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP9(v_start varchar, v_end varchar) is
select 'Sur' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.164','SUR-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP10(v_start varchar, v_end varchar) is
select 'Buraimi' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('BR-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
begin
m_report_year := 2006;
v_start:='20060701000000';
v_end:='20061001000000';
/** Dialup Accounts Usage on each month **/
dbms_output.put_line('Dialup Accounts Usage on each month during the Year ' || m_report_year);
dbms_output.put_line('POP Name MM-YYYY No. of Seconds Avg. No. of Seconds');
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP1(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP2(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP3(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP4(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP5(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP6(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP7(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP8(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP9(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP10(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
end;
spool off
Dialup Accounts Usage on each month during the Year 2006
POP Name MM-YYYY No. of Seconds Avg. No. of Seconds
Technical Building 07-2006 1,468,439,634 1,985.848
Technical Building 08-2006 1,476,030,818 1,954.927
Technical Building 09-2006 1,385,143,427 1,917.764
Training Center 07-2006 19,481,275 2,193.343
Training Center 08-2006 7,368,849 2,317.977
Training Center 09-2006
Al-Khuwair 07-2006 327,753,498 1,929.392
Al-Khuwair 08-2006 326,043,930 1,867.751
Al-Khuwair 09-2006 314,307,853 1,884.758
Sallalah 07-2006 297,238,088 2,127.765
Sallalah 08-2006 291,646,501 2,049.130
Sallalah 09-2006 256,812,968 2,050.403
Sohar 07-2006 499,669,759 2,002.588
Sohar 08-2006 517,602,784 1,996.208
Sohar 09-2006 460,677,766 1,965.760
Nizwa 07-2006 313,445,474 1,804.896
Nizwa 08-2006 336,749,026 1,820.708
Nizwa 09-2006 279,534,466 1,809.074
Masirah 07-2006 17,417,301 2,315.822
Masirah 08-2006 20,053,961 2,791.087
Masirah 09-2006 17,225,347 2,656.593
Ibri 07-2006
Ibri 08-2006
Ibri 09-2006
Sur 07-2006 146,555,060 1,765.681
Sur 08-2006 148,694,745 1,710.157
Sur 09-2006 138,260,990 1,687.962
Buraimi 07-2006
Buraimi 08-2006
Buraimi 09-2006
PL/SQL procedure successfully completed.
Elapsed: 14:27:26.17
set serveroutput on size 1000000
set timing on
set linesize 132
spool ABCReports51_new.lst
declare
m_report_year number(8);
v_start varchar(38);
v_end varchar(38);
-- Fetch all Session Events for Non CyberCafe (Only IP Service) Product Events
cursor SessionUsagePOP1(v_start varchar, v_end varchar) is
select 'Technical Building' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.21','62.231.255.22','62.231.255.23','62.231.255.24','62.231.255.25','62.231.255.26','62.231.255.27','62.231.255.28','62.231.255.29','62.231.255.30','62.231.255.31','62.231.255.32','62.231.255.33','62.231.255.34','62.231.255.35','62.231.255.36','62.231.255.37','62.231.255.38','62.231.255.39','62.231.255.40','62.231.255.43','62.231.255.44','62.231.255.255','ADSL-7301-Test','AKO2_ERX700','AZA1_ERX700','GHA1_ERX700','GMU4_ERX700','HMR1_ERX700','HMSQ_ERX700','KWR1_ERX700','MUS','MUS1_ERX700','MUT','MUT1_ERX700','MUTRAH-ERX','OMAN-ADSL-Test','QUR2_ERX700','Qur','SEB2_ERX700','TECH_BLDG','WAT1_ERX700','WKB1_ERX700','azaiba','TB-C10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP2(v_start varchar, v_end varchar) is
select 'Training Center' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.224','62.231.255.225','62.231.255.226','62.231.255.227','62.231.255.228','TRG-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP3(v_start varchar, v_end varchar) is
select 'Al-Khuwair' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.208') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP4(v_start varchar, v_end varchar) is
select 'Sallalah' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.192.20','62.231.192.21','62.231.192.22','62.231.255.132','62.231.255.133','62.231.255.134','SAL-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP5(v_start varchar, v_end varchar) is
select 'Sohar' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.200.20','62.231.200.21','62.231.255.148','62.231.255.149','SOH-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP6(v_start varchar, v_end varchar) is
select 'Nizwa' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.216.20','62.231.255.180','62.231.255.181','NIZ-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP7(v_start varchar, v_end varchar) is
select 'Masirah' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('212.72.13.41') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP8(v_start varchar, v_end varchar) is
select 'Ibri' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.224.20') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP9(v_start varchar, v_end varchar) is
select 'Sur' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('62.231.255.164','SUR-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
cursor SessionUsagePOP10(v_start varchar, v_end varchar) is
select 'Buraimi' PopName, sum(end_t - start_t) UsageSec, avg(end_t - start_t) AvgSec
from event_bal_impacts_t c, event_session_dialup_t b, event_t_view a
where
end_t between date2unix(v_start) and date2unix(v_end) and
b.obj_id0 = a.poid_id0 and
c.obj_id0 = a.poid_id0 and
c.rec_id = 0 and
a.service_obj_type = '/service/ip' and
a.poid_type = '/event/session/dialup' and
b.termserv_id in ('BR-10K-ADSL') and
c.product_obj_id0 not in
select poid_id0 from product_t
where name like '%Cyber%'
begin
m_report_year := 2006;
v_start:='20060701000000';
v_end:='20061001000000';
/** Dialup Accounts Usage on each month **/
dbms_output.put_line('Dialup Accounts Usage on each month during the Year ' || m_report_year);
dbms_output.put_line('POP Name MM-YYYY No. of Seconds Avg. No. of Seconds');
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP1(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP2(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP3(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP4(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP5(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP6(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP7(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP8(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP9(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
for c1 in 7..9
loop <<c1_loop>>
for c11 in SessionUsagePOP10(
m_report_year || lpad(c1, 2, '0') || '01000000',
m_report_year || lpad(c1 + 1, 2, '0') || '01000000'
loop <<c11_loop>>
dbms_output.put_line(
rpad(c11.PopName,25, ' ') || ' ' ||
to_char(c1, '00') || '-' ||
m_report_year || ' ' ||
to_char(c11.UsageSec,'999,999,999,999') || ' ' ||
to_char(c11.AvgSec,'999,999,999.999')
end loop c11_loop;
end loop c1_loop;
end;
spool off -
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 -
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
Maybe you are looking for
-
iam new to OBIEE, while iam starting the services of Oracle BI Server, then display an error as "Could not start the Oracle BI Server sercice on Local Computer. Error 1064: An expception occurred in the service when handling the control request." why
-
thats all i can say. used to print in firefox on my imac. haven't been able to do so in months. I can print perfectly in safari so it isn't my printer. I have checked every setting in every system and nothing changes the outcome
-
I don't know how this started, but I'm unable to shut down my computer because I get message saying my photos are being synced with online... which they aren't. Now iphoto is frozen. Can't shut down computer or view photos. Thanks for any help you
-
Magic mouse gestures not working
Hi, the gestures of my magic mouse stop working. I've tried another mouse on my laptop and it work I also tried my mouse on another laptop and the same problem happens. it's behaving like a "normal" mouse. Is this a hardware problem? if yes, How do I
-
Constructing a new Document from External Nodes
Constructing a new Document from External Nodes I have a situation where: 1. I have an existing XML Document 2. I need to parse for specific Nodes under varying conditions 3. Once the Node is identified -- I would like to append this node