Query on performance
Hi,
I would like to know how is the performance and stability of SOA Suite on the Web-logic Server compared to the old Oracle OC4J server. Any pointers on this would help us to present a case for migration of our in-house application to the new version of the product.
Regards,
MD
you may find this stuff @
http://download.oracle.com/docs/cd/E12839_01/upgrade.1111/e10126/wls_oc4j_comparisons.htm
cheers,
Jitendra
Similar Messages
-
Asset query execution performance after upgrade from 4.6C to ECC 6.0+EHP4
Hi,guys
I am encounted a weird problems about asset query execution performance after upgrade to ECC 6.0.
Our client had migrated sap system from 4.6c to ECC 6.0. We test all transaction code and related stand report and query.
Everything is working normally except this asset depreciation query report. It is created based on ANLP, ANLZ, ANLA, ANLB, ANLC table; there is also some ABAP code for additional field.
This report execution costed about 6 minutes in 4.6C system; however it will take 25 minutes in ECC 6.0 with same selection parameter.
At first, I am trying to find some difference in table index ,structure between 4.6c and ECC 6.0,but there is no difference about it.
i am wondering why the other query reports is running normally but only this report running with too long time execution dump messages even though we do not make any changes for it.
your reply is very appreciated
Regards
BrianThanks for your replies.
I check these notes, unfortunately it is different our situation.
Our situation is all standard asset report and query (sq01) is running normally except this query report.
I executed se30 for this query (SQ01) at both 4.6C and ECC 6.0.
I find there is some difference in select sequence logic even though same query without any changes.
I list there for your reference.
4.6C
AQA0FI==========S2============
Open Cursor ANLP 38,702 39,329,356 = 39,329,356 34.6 AQA0FI==========S2============ DB Opens
Fetch ANLP 292,177 30,378,351 = 30,378,351 26.7 26.7 AQA0FI==========S2============ DB OpenS
Select Single ANLC 15,012 19,965,172 = 19,965,172 17.5 17.5 AQA0FI==========S2============ DB OpenS
Select Single ANLA 13,721 11,754,305 = 11,754,305 10.3 10.3 AQA0FI==========S2============ DB OpenS
Select Single ANLZ 3,753 3,259,308 = 3,259,308 2.9 2.9 AQA0FI==========S2============ DB OpenS
Select Single ANLB 3,753 3,069,119 = 3,069,119 2.7 2.7 AQA0FI==========S2============ DB OpenS
ECC 6.0
Perform FUNKTION_AUSFUEHREN 2 358,620,931 355
Perform COMMAND_QSUB 1 358,620,062 68
Call Func. RSAQ_SUBMIT_QUERY_REPORT 1 358,569,656 88
Program AQIWFI==========S2============ 2 358,558,488 1,350
Select Single ANLA 160,306 75,576,052 = 75,576,052
Open Cursor ANLP 71,136 42,096,314 = 42,096,314
Select Single ANLC 71,134 38,799,393 = 38,799,393
Select Single ANLB 61,888 26,007,721 = 26,007,721
Select Single ANLZ 61,888 24,072,111 = 24,072,111
Fetch ANLP 234,524 13,510,646 = 13,510,646
Close Cursor ANLP 71,136 2,017,654 = 2,017,654
We can see first open cursor ANLP ,fetch ANLP then select ANLC,ANLA,ANLZ,ANLB at 4.C.
But it changed to first select ANLA,and open cursor ANLP,then select ANLC,ANLB,ANLZ,at last fetch ANLP.
Probably,it is the real reason why it is running long time in ECC 6.0.
Is there any changes for query selcection logic(table join function) in ECC 6.0. -
Urgent query regarding performance
hi
i have one query regarding performance.iam using interactive reporting and workspace.
i have all the linsence server,shared services,and Bi services and ui services and oracle9i which has metadata installed in one system(one server).data base which stores relationaldata(DB2) on another system.(i.e 2 systems in total).
in order to increase performance i made some adjustments
i installed hyperion BI server services, UI services,license server and shared services server such that all web applications (that used web sphere 5.1) such as shared services and UI services in server1(or computer1).and remaining linsence and bi server services in computer2 and i installed database(db2) on another computer3.(i.e 3 systems in total)
my query : oracle 9i which has metadata where to install that in ( computer 1 or in computer 2 )
i want to get best performance.where to install that oracle 9i which has metadata stored in it.
for any queries please reply mail
[email protected]
9930120470You should know that executing a query is always slower the first time. Then Oracle can optimise your query and store it temporary for further executions. But passing from 3 minutes to 3 seconds, maybe your original query is really, really slow. Most of the times I only win few milliseconds. If Oracle is able to optimize it to 3 seconds. You must clearly rewrite your query.
Things you should know to enhance your execution time : try to reduce the number of nested loops, nested loops give your an exponential execution time which is really slow :
for rec1 in (select a from b) loop
for rec2 in (select c from d) loop
end loop;
end loop;Anything like that is bad.
Try to avoid Cartesian products by writing the best where clause possible.
select a.a,
b.b
from a,
b
where b.b > 1This is bad and slow. -
Increase Query Designer Performance?
Hi together,
Is it possible to increase the performance of the Query Designer? I have a query which is based on a MultiProvider with several InfoCubes. If i work some minutes with the Query Designer, it becomes slower and slower. Then it takes from one up to ten seconds to see the digit in my formula, which i pressed on the keyboard just before. This is very awful! At least the half of the time i work with the Query Designer i have to wait, that this tool stops calculating something or displaying the hourglass. Very inefficient.
Thanks for hints in advance!>
Ricardo Rosa wrote:
> Hi Timo,
>
> Usually this kind of issue should be solved with frontend patch upgrade, have you tried to reproduce this with latest FEP?
>
> Other suggestion which should help is to search for RSZ tables inconsistencies with report ANALYZE_RSZ_TABLES, this can search for inconsistencies which can decrease the performance in the query definition and also suggest a fix for that.
>
> Kind regards,
>
> Ricardo
Hi Ricardo,
Yes, i've already upgraded to latest FEP version.
But thank you for this report. It looks very helpful!
>
Arun Varadarajan wrote:
> Shikha,
> The question was regarding Query designer performance and not query performance...
>
> We faced similar issue earlier - even opening of Query designer took a huge amount of time but then on upgrading upgrading my system to 1 GB ram most of the performance issue went away... check the RAM usage in the task manager and CPU utilization. This might make query designer faster.
Hi Arun,
At this point there is no more hope for me, as my system has already 2 GB RAM and a dual core cpu with 2.2 GHz. -
How to improve query & loading performance.
Hi All,
How to improve query & loading performance.
Thanks in advance.
Rgrds
shobaHi Shoba
There are lot of things to improve the query and loading performance.
please refer oss note :557870 : Frequently asked questions on query performance
also refer to
weblogs:
/people/prakash.darji/blog/2006/01/27/query-creation-checklist
/people/prakash.darji/blog/2006/01/26/query-optimization
performance docs on query
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3f66ba90-0201-0010-ac8d-b61d8fd9abe9
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cccad390-0201-0010-5093-fd9ec8157802
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ce7fb368-0601-0010-64ba-fadc985a1f94
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c8c4d794-0501-0010-a693-918a17e663cc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/064fed90-0201-0010-13ae-b16fa4dab695
This is the oss notes of FAQ on query performance
1. What kind of tools are available to monitor the overall Query Performance?
1. BW Statistics
2. BW Workload Analysis in ST03N (Use Export Mode!)
3. Content of Table RSDDSTAT
2. Do I have to do something to enable such tools?
Yes, you need to turn on the BW Statistics:
RSA1, choose Tools -> BW statistics for InfoCubes
(Choose OLAP and WHM for your relevant Cubes)
3. What kind of tools is available to analyze a specific query in detail?
1. Transaction RSRT
2. Transaction RSRTRACE
4. Do I have an overall query performance problem?
i. Use ST03N -> BW System load values to recognize the problem. Use the number given in table 'Reporting - InfoCubes:Share of total time (s)' to check if one of the columns %OLAP, %DB, %Frontend shows a high number in all Info Cubes.
ii. You need to run ST03N in expert mode to get these values
5. What can I do if the database proportion is high for all queries?
Check:
1. If the database statistic strategy is set up properly for your DB platform (above all for the BW specific tables)
2. If database parameter set up accords with SAP Notes and SAP Services (EarlyWatch)
3. If Buffers, I/O, CPU, memory on the database server are exhausted?
4. If Cube compression is used regularly
5. If Database partitioning is used (not available on all DB platforms)
6. What can I do if the OLAP proportion is high for all queries?
Check:
1. If the CPUs on the application server are exhausted
2. If the SAP R/3 memory set up is done properly (use TX ST02 to find bottlenecks)
3. If the read mode of the queries is unfavourable (RSRREPDIR, RSDDSTAT, Customizing default)
7. What can I do if the client proportion is high for all queries?
Check whether most of your clients are connected via a WAN connection and the amount of data which is transferred is rather high.
8. Where can I get specific runtime information for one query?
1. Again you can use ST03N -> BW System Load
2. Depending on the time frame you select, you get historical data or current data.
3. To get to a specific query you need to drill down using the InfoCube name
4. Use Aggregation Query to get more runtime information about a single query. Use tab All data to get to the details. (DB, OLAP, and Frontend time, plus Select/ Transferred records, plus number of cells and formats)
9. What kind of query performance problems can I recognize using ST03N
values for a specific query?
(Use Details to get the runtime segments)
1. High Database Runtime
2. High OLAP Runtime
3. High Frontend Runtime
10. What can I do if a query has a high database runtime?
1. Check if an aggregate is suitable (use All data to get values "selected records to transferred records", a high number here would be an indicator for query performance improvement using an aggregate)
2. o Check if database statistics are update to data for the Cube/Aggregate, use TX RSRV output (use database check for statistics and indexes)
3. Check if the read mode of the query is unfavourable - Recommended (H)
11. What can I do if a query has a high OLAP runtime?
1. Check if a high number of Cells transferred to the OLAP (use "All data" to get value "No. of Cells")
2. Use RSRT technical Information to check if any extra OLAP-processing is necessary (Stock Query, Exception Aggregation, Calc. before Aggregation, Virtual Char. Key Figures, Attributes in Calculated Key Figs, Time-dependent Currency Translation) together with a high number of records transferred.
3. Check if a user exit Usage is involved in the OLAP runtime?
4. Check if large hierarchies are used and the entry hierarchy level is as deep as possible. This limits the levels of the hierarchy that must be processed. Use SE16 on the inclusion tables and use the List of Value feature on the column successor and predecessor to see which entry level of the hierarchy is used.
5. Check if a proper index on the inclusion table exist
12. What can I do if a query has a high frontend runtime?
1. Check if a very high number of cells and formatting are transferred to the Frontend (use "All data" to get value "No. of Cells") which cause high network and frontend (processing) runtime.
2. Check if frontend PC are within the recommendation (RAM, CPU MHz)
3. Check if the bandwidth for WAN connection is sufficient
and the some threads:
how can i increse query performance other than creating aggregates
How to improve query performance ?
Query performance - bench marking
may be helpful
Regards
C.S.Ramesh
[email protected] -
How to make sql to use index/make to query to perform better
Hi,
I have 2 sql query which results the same.
But both has difference in SQL trace.
create table test_table
(u_id number(10),
u_no number(4),
s_id number(10),
s_no number(4),
o_id number(10),
o_no number(4),
constraint pk_test primary key(u_id, u_no));
insert into test_table(u_id, u_no, s_id, s_no, o_id, o_no)
values (2007030301, 1, 1001, 1, 2001, 1);
insert into test_table(u_id, u_no, s_id, s_no, o_id, o_no)
values (2007030302, 1, 1001, 1, 2001, 2);
insert into test_table(u_id, u_no, s_id, s_no, o_id, o_no)
values (2007030303, 1, 1001, 1, 2001, 3);
insert into test_table(u_id, u_no, s_id, s_no, o_id, o_no)
values (2007030304, 1, 1001, 1, 2001, 4);
insert into test_table(u_id, u_no, s_id, s_no, o_id, o_no)
values (2007030305, 1, 1002, 1, 1001, 2);
insert into test_table(u_id, u_no, s_id, s_no, o_id, o_no)
values (2007030306, 1, 1002, 1, 1002, 1);
commit;
CREATE INDEX idx_test_s_id ON test_table(s_id, s_no);
set autotrace on
select s_id, s_no, o_id, o_no
from test_table
where s_id <> o_id
and s_no <> o_no
union all
select o_id, o_no, s_id, s_no
from test_table
where s_id <> o_id
and s_no <> o_no;
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=6 Card=8 Bytes=416)
1 0 UNION-ALL
2 1 TABLE ACCESS (FULL) OF 'TEST_TABLE' (TABLE) (Cost=3 Card=4 Bytes=208)
3 1 TABLE ACCESS (FULL) OF 'TEST_TABLE' (TABLE) (Cost=3 Card=4 Bytes=208)
Statistics
223 recursive calls
2 db block gets
84 consistent gets
0 physical reads
0 redo size
701 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
8 rows processed
-- i didnt understand why the above query is not using the index idx_test_s_id.
-- But still it is faster
select s_id, s_no, o_id, o_no
from test_table
where (u_id, u_no) in
(select u_id, u_no from test_table
minus
select u_id, u_no from test_table
where s_id = o_id
or s_no = o_no)
union all
select o_id, o_no, s_id, s_no
from test_table
where (u_id, u_no) in
(select u_id, u_no from test_table
minus
select u_id, u_no from test_table
where s_id = o_id
or s_no = o_no);
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=16 Card=2 Bytes=156)
1 0 UNION-ALL
2 1 FILTER
3 2 TABLE ACCESS (FULL) OF 'TEST_TABLE' (TABLE) (Cost=3 Card=6 Bytes=468)
4 2 MINUS
5 4 INDEX (UNIQUE SCAN) OF 'PK_TEST' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=26)
6 4 TABLE ACCESS (BY INDEX ROWID) OF 'TEST_TABLE' (TABLE) (Cost=2 Card=1 Bytes=78)
7 6 INDEX (UNIQUE SCAN) OF 'PK_TEST' (INDEX (UNIQUE)) (Cost=1 Card=1)
8 1 FILTER
9 8 TABLE ACCESS (FULL) OF 'TEST_TABLE' (TABLE) (Cost=3 Card=6 Bytes=468)
10 8 MINUS
11 10 INDEX (UNIQUE SCAN) OF 'PK_TEST' (INDEX (UNIQUE)) (Cost=1 Card=1 Bytes=26)
12 10 TABLE ACCESS (BY INDEX ROWID) OF 'TEST_TABLE' (TABLE) (Cost=2 Card=1 Bytes=78)
13 12 INDEX (UNIQUE SCAN) OF 'PK_TEST' (INDEX (UNIQUE)) (Cost=1 Card=1)
Statistics
53 recursive calls
8 db block gets
187 consistent gets
0 physical reads
0 redo size
701 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
8 rows processed
-- The above query is using index PK_TEST. But still it has FULL SCAN to the
-- table two times it has the more cost.
1st query --> SELECT STATEMENT Optimizer=ALL_ROWS (Cost=6 Card=8 Bytes=416)
2nd query --> SELECT STATEMENT Optimizer=ALL_ROWS (Cost=16 Card=2 Bytes=156)
My queries are:
1) performance wise which query is better?
2) how do i make the 1st query to use an index
3) is there any other method to get the same result by using any index
Appreciate your immediate help.
Best regards
MuthuHi William
Nice...it works.. I have added "o_id" and "o_no" are in part of the index
and now the query uses the index
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=8 Bytes=416)
1 0 UNION-ALL
2 1 INDEX (FULL SCAN) OF 'IDX_TEST_S_ID' (INDEX) (Cost=1 Card=4 Bytes=208)
3 1 INDEX (FULL SCAN) OF 'IDX_TEST_S_ID' (INDEX) (Cost=1 Card=4 Bytes=208)
Statistics
7 recursive calls
0 db block gets
21 consistent gets
0 physical reads
0 redo size
701 bytes sent via SQL*Net to client
507 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
8 rows processed
But my questions are:
1) In a where clause, if "<>" condition is used, then, whether the system will use the index. Because I have observed in several situations even though the column in where clause is indexed, since the where condition is "like" or "is null/is not null"
then the index is not used. Same as like this, i assumed, if we use <> then indexes will not be used. Is it true?
2) Now, after adding "o_id" and "o_no" columns to the index, the Execution plan is:
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=8 Bytes=416)
1 0 UNION-ALL
2 1 INDEX (FULL SCAN) OF 'IDX_TEST_S_ID' (INDEX) (Cost=1 Card=4 Bytes=208)
3 1 INDEX (FULL SCAN) OF 'IDX_TEST_S_ID' (INDEX) (Cost=1 Card=4 Bytes=208)
Before it was :
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=6 Card=8 Bytes=416)
1 0 UNION-ALL
2 1 TABLE ACCESS (FULL) OF 'TEST_TABLE' (TABLE) (Cost=3 Card=4 Bytes=208)
3 1 TABLE ACCESS (FULL) OF 'TEST_TABLE' (TABLE) (Cost=3 Card=4 Bytes=208)
Difference only in Cost (reduced), not in Card, Bytes.
Can you explain, how can i decide which makes the performace better (Cost / Card / Bytes). Full Scan / Range Scan?
On statistics also:
Before:
Statistics
52 recursive calls
0 db block gets
43 consistent gets
0 physical reads
0 redo size
701 bytes sent via SQL*Net to client
507 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
8 rows processed
After:
Statistics
7 recursive calls
0 db block gets
21 consistent gets
0 physical reads
0 redo size
701 bytes sent via SQL*Net to client
507 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
8 rows processed
Difference in recursive calls & consistent gets.
Which one shows the query with better performance?
Please explain..
Regards
Muthu -
Identical query, unusable performance in one environment - please help
We are attempting to upgrade from 10.2.0.4 to 11.2.0.2 but one of our reporting queries is completely struggling (30 seconds in our current environment, 4000 seconds in our upgraded environment).
Note that the caveat is that it will be very difficult for me to modify the SQL (its coming from a different IT group, and their position is that it should not have to be modified given that it runs so well in the current production environment).
The query is exactly the same in both environments, and carries the same SQL_ID, but explain plans are different.
The environment in which the query works is version 10.2.0.4, and elapsed time per the trace is 30.15 seconds, 841 rows returned.
The new environment is 11.2.0.2, elapsed time is 4035 seconds, 841 rows returned.
The environments are comparable in terms of CPU/Memory/IO (both are writing to NFS mounts on our NetApp)
SGA_MAX/TARGET and PGA_AGGREGATE_TARGET are the same in both environments, as are HASH_AREA_SIZE and SORT_AREA_SIZE.
Underlying table data is identical, and all indexes are the same in both environments. Stats have been gathered and this behavior has persisted through multiple reboots of the databases.
I've run traces on the statements in both environments and the performance difference appears to be due to direct path read/write temp:
The SQL
SELECT DISTINCT
a.emplid,
a.name,
rds.sa_get_stdnt_email_fn (a.emplid),
a.req_term,
a.req_term_ldesc,
CASE
WHEN (a.req_acad_plan = 'PKINXXXBBS' AND a.cum_gpa >= d.gpa)
THEN
NVL (c.num_met, 0) + 1
WHEN (b.gpa >= d.gpa AND a.req_acad_plan <> 'PKINXXXBBS')
THEN
NVL (c.num_met, 0) + 1
ELSE
NVL (c.num_met, 0)
END
AS "Requirement Status",
a.cum_total_passed AS "Cumulative Units",
a.admit_term,
a.admit_term_ldesc,
a.acad_plan,
a.acad_plan_ldesc,
a.academic_level,
a.academic_level_ldesc,
TO_CHAR (a.rpt_date, 'MM/DD/YYYY') AS rpt_date,
TO_CHAR (NVL (b.gpa, 0), '0.000') AS gpa,
TO_CHAR (NVL (a.cum_gpa, 0), '0.000') AS cum_gpa
FROM sa.rec_sm_stdnt_deg_completion a,
( SELECT DISTINCT
CASE
WHEN SUM (b_sub.units_earned) = 0 THEN 0
ELSE SUM (b_sub.grade_points) / SUM (b_sub.units_earned)
END
AS gpa,
b_sub.emplid,
b_sub.acad_career,
b_sub.acad_plan,
b_sub.req_acad_plan,
b_sub.req_term,
b_sub.academic_level,
b_sub.rqrmnt_group
FROM sa.rec_sm_stdnt_deg_completion b_sub,
hrsa_extr.ps_rq_grp_tbl g3,
hrsa_extr.ps_rq_main_tbl m3
WHERE b_sub.req_acad_plan IS NOT NULL
AND b_sub.acad_career = 'UGRD'
AND b_sub.acad_prog = 'UBACH'
AND b_sub.acad_plan = b_sub.req_acad_plan
AND b_sub.grade <> 'IP'
AND b_sub.impact_flag = 'Y'
AND g3.effdt =
(SELECT MAX (g3_ed.effdt)
FROM hrsa_extr.ps_rq_grp_tbl g3_ed
WHERE g3_ed.rqrmnt_group = g3.rqrmnt_group
AND g3_ed.effdt <= b_sub.req_term_begin_date)
AND g3.rqrmnt_group = b_sub.rqrmnt_group
AND m3.effdt =
(SELECT MAX (m3_ed.effdt)
FROM hrsa_extr.ps_rq_main_tbl m3_ed
WHERE m3_ed.requirement = m3.requirement
AND m3_ed.effdt <= b_sub.req_term_begin_date)
AND m3.requirement = b_sub.requirement
GROUP BY b_sub.emplid,
b_sub.acad_career,
b_sub.acad_plan,
b_sub.req_acad_plan,
b_sub.req_term,
b_sub.academic_level,
b_sub.rqrmnt_group) b,
( SELECT c_sub.emplid,
c_sub.acad_career,
c_sub.acad_plan,
c_sub.req_acad_plan,
c_sub.req_term,
c_sub.academic_level,
c_sub.rqrmnt_group,
COUNT (*) AS num_met
FROM sa.rec_sm_stdnt_deg_completion c_sub,
hrsa_extr.ps_rq_grp_tbl g2,
hrsa_extr.ps_rq_main_tbl m2
WHERE c_sub.rqrmnt_line_status = 'COMP'
AND c_sub.grade <> 'IP'
AND c_sub.impact_flag = 'Y'
AND c_sub.acad_career = 'UGRD'
AND c_sub.acad_prog = 'UBACH'
AND c_sub.acad_plan = c_sub.req_acad_plan
AND g2.effdt =
(SELECT MAX (g2_ed.effdt)
FROM hrsa_extr.ps_rq_grp_tbl g2_ed
WHERE g2_ed.rqrmnt_group = g2.rqrmnt_group
AND g2_ed.effdt <= c_sub.req_term_begin_date)
AND g2.rqrmnt_group = c_sub.rqrmnt_group
AND m2.effdt =
(SELECT MAX (m2_ed.effdt)
FROM hrsa_extr.ps_rq_main_tbl m2_ed
WHERE m2_ed.requirement = m2.requirement
AND m2_ed.effdt <= c_sub.req_term_begin_date)
AND m2.requirement = c_sub.requirement
GROUP BY c_sub.emplid,
c_sub.acad_career,
c_sub.acad_plan,
c_sub.req_acad_plan,
c_sub.req_term,
c_sub.academic_level,
c_sub.rqrmnt_group) c,
hrsa_extr.ps_smo_rdr_imp_pln d,
hrsa_extr.ps_rq_grp_tbl g,
hrsa_extr.ps_rq_main_tbl m
WHERE a.acad_career = 'UGRD'
AND a.acad_prog = 'UBACH'
AND a.req_acad_plan IN (N'NUPPXXXBBS', N'NURPBASBBS', N'NURPXXXBBS')
AND a.academic_level IN (N'10', N'20', N'30', N'40', N'50', N'GR')
AND a.acad_plan = a.req_acad_plan
AND a.impact_flag = 'Y'
AND g.effdt =
(SELECT MAX (g_ed.effdt)
FROM hrsa_extr.ps_rq_grp_tbl g_ed
WHERE g_ed.rqrmnt_group = g.rqrmnt_group
AND g_ed.effdt <= a.req_term_begin_date)
AND g.rqrmnt_group = a.rqrmnt_group
AND m.effdt =
(SELECT MAX (m_ed.effdt)
FROM hrsa_extr.ps_rq_main_tbl m_ed
WHERE m_ed.requirement = m.requirement
AND m_ed.effdt <= a.req_term_begin_date)
AND m.requirement = a.requirement
AND a.emplid = b.emplid(+)
AND a.acad_career = b.acad_career(+)
AND a.acad_plan = b.acad_plan(+)
AND a.req_acad_plan = b.req_acad_plan(+)
AND a.academic_level = b.academic_level(+)
AND a.req_term = b.req_term(+)
AND a.rqrmnt_group = b.rqrmnt_group(+)
AND a.emplid = c.emplid(+)
AND a.acad_career = c.acad_career(+)
AND a.acad_plan = c.acad_plan(+)
AND a.req_acad_plan = c.req_acad_plan(+)
AND a.academic_level = c.academic_level(+)
AND a.req_term = c.req_term(+)
AND a.rqrmnt_group = c.rqrmnt_group(+)
AND d.acad_plan = a.req_acad_plan
ORDER BY 6 DESC, 2 ASC;New environment (11.2.0.2), takes 4000 seconds according to tkprof
Explain plan
PLAN_TABLE_OUTPUT
Plan hash value: 4117596694
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 314 | 15231 (1)| 00:03:03 |
| 1 | SORT UNIQUE | | 1 | 314 | 15230 (1)| 00:03:03 |
| 2 | NESTED LOOPS OUTER | | 1 | 314 | 15227 (1)| 00:03:03 |
| 3 | NESTED LOOPS OUTER | | 1 | 285 | 15216 (1)| 00:03:03 |
| 4 | NESTED LOOPS | | 1 | 256 | 15205 (1)| 00:03:03 |
| 5 | NESTED LOOPS | | 1 | 241 | 15204 (1)| 00:03:03 |
| 6 | NESTED LOOPS | | 1 | 223 | 15203 (1)| 00:03:03 |
| 7 | NESTED LOOPS | | 17 | 731 | 15186 (1)| 00:03:03 |
| 8 | VIEW | VW_SQ_3 | 998 | 27944 | 15186 (1)| 00:03:03 |
| 9 | HASH GROUP BY | | 998 | 62874 | 15186 (1)| 00:03:03 |
| 10 | MERGE JOIN | | 29060 | 1787K| 15184 (1)| 00:03:03 |
| 11 | SORT JOIN | | 26 | 1248 | 15180 (1)| 00:03:03 |
| 12 | TABLE ACCESS BY INDEX ROWID | REC_SM_STDNT_DEG_COMPLETION | 26 | 1248 | 15179 (1)| 00:03:03 |
|* 13 | INDEX SKIP SCAN | REC0SM_STDNT_DEG_IDX | 26 | | 15168 (1)| 00:03:03 |
|* 14 | SORT JOIN | | 1217 | 18255 | 4 (25)| 00:00:01 |
| 15 | INDEX FAST FULL SCAN | PS3RQ_GRP_TBL | 1217 | 18255 | 3 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | PS_RQ_GRP_TBL | 1 | 15 | 0 (0)| 00:00:01 |
|* 17 | TABLE ACCESS BY USER ROWID | REC_SM_STDNT_DEG_COMPLETION | 1 | 180 | 1 (0)| 00:00:01 |
|* 18 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 18 | 1 (0)| 00:00:01 |
| 19 | SORT AGGREGATE | | 1 | 18 | | |
| 20 | FIRST ROW | | 1 | 18 | 2 (0)| 00:00:01 |
|* 21 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_MAIN_TBL | 1 | 18 | 2 (0)| 00:00:01 |
|* 22 | INDEX FULL SCAN | PS0SMO_RDR_IMP_PLN | 1 | 15 | 1 (0)| 00:00:01 |
|* 23 | VIEW PUSHED PREDICATE | | 1 | 29 | 11 (19)| 00:00:01 |
| 24 | SORT GROUP BY | | 1 | 52 | 11 (19)| 00:00:01 |
| 25 | VIEW | VM_NWVW_5 | 1 | 52 | 10 (10)| 00:00:01 |
|* 26 | FILTER | | | | | |
| 27 | SORT GROUP BY | | 1 | 165 | 10 (10)| 00:00:01 |
|* 28 | FILTER | | | | | |
| 29 | NESTED LOOPS | | 1 | 165 | 7 (0)| 00:00:01 |
| 30 | NESTED LOOPS | | 1 | 147 | 6 (0)| 00:00:01 |
| 31 | NESTED LOOPS | | 1 | 117 | 5 (0)| 00:00:01 |
|* 32 | TABLE ACCESS BY INDEX ROWID | REC_SM_STDNT_DEG_COMPLETION | 1 | 90 | 4 (0)| 00:00:01 |
|* 33 | INDEX RANGE SCAN | REC1SM_STDNT_DEG_IDX | 1 | | 3 (0)| 00:00:01 |
|* 34 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 27 | 1 (0)| 00:00:01 |
| 35 | SORT AGGREGATE | | 1 | 15 | | |
| 36 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 37 | INDEX RANGE SCAN (MIN/MAX)| PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
|* 38 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 30 | 1 (0)| 00:00:01 |
|* 39 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 18 | 1 (0)| 00:00:01 |
|* 40 | VIEW PUSHED PREDICATE | | 1 | 29 | 11 (19)| 00:00:01 |
| 41 | SORT GROUP BY | | 1 | 32 | 11 (19)| 00:00:01 |
| 42 | VIEW | VM_NWVW_4 | 1 | 32 | 10 (10)| 00:00:01 |
|* 43 | FILTER | | | | | |
| 44 | SORT GROUP BY | | 1 | 166 | 10 (10)| 00:00:01 |
|* 45 | FILTER | | | | | |
|* 46 | FILTER | | | | | |
| 47 | NESTED LOOPS | | 1 | 166 | 7 (0)| 00:00:01 |
| 48 | NESTED LOOPS | | 1 | 148 | 6 (0)| 00:00:01 |
| 49 | NESTED LOOPS | | 1 | 118 | 5 (0)| 00:00:01 |
|* 50 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 27 | 2 (0)| 00:00:01 |
|* 51 | TABLE ACCESS BY INDEX ROWID | REC_SM_STDNT_DEG_COMPLETION | 1 | 91 | 3 (0)| 00:00:01 |
|* 52 | INDEX RANGE SCAN | REC1SM_STDNT_DEG_IDX | 1 | | 2 (0)| 00:00:01 |
|* 53 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 30 | 1 (0)| 00:00:01 |
|* 54 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 18 | 1 (0)| 00:00:01 |
| 55 | SORT AGGREGATE | | 1 | 15 | | |
| 56 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 57 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
call count cpu elapsed disk query current rows
Parse 1 6.59 6.66 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 1521.36 4028.91 2256624 240053408 0 841
total 4 1527.95 4035.57 2256624 240053408 0 841
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
Disk file operations I/O 3 0.07 0.11
db file sequential read 10829 0.12 16.62
direct path write temp 72445 0.30 293.71
direct path read temp 72445 0.58 2234.14
asynch descriptor resize 22 0.00 0.00
SQL*Net more data to client 9 0.00 0.00
SQL*Net message from client 2 0.84 1.25
********************************************************************************Current production (10.2.0.4), takes 30 seconds
PLAN_TABLE_OUTPUT
Plan hash value: 2178773127
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 331 | 89446 (2)| 00:17:54 |
| 1 | SORT UNIQUE | | 1 | 331 | 89445 (2)| 00:17:54 |
| 2 | NESTED LOOPS | | 1 | 331 | 89440 (2)| 00:17:54 |
| 3 | NESTED LOOPS | | 1 | 316 | 89439 (2)| 00:17:54 |
|* 4 | HASH JOIN OUTER | | 1 | 298 | 89438 (2)| 00:17:54 |
|* 5 | HASH JOIN OUTER | | 1 | 240 | 59625 (2)| 00:11:56 |
| 6 | NESTED LOOPS | | 1 | 182 | 29815 (2)| 00:05:58 |
|* 7 | TABLE ACCESS FULL | REC_SM_STDNT_DEG_COMPLETION | 1 | 167 | 29814 (2)| 00:05:58 |
|* 8 | INDEX FULL SCAN | PS0SMO_RDR_IMP_PLN | 1 | 15 | 1 (0)| 00:00:01 |
| 9 | VIEW | | 1 | 58 | 29809 (2)| 00:05:58 |
| 10 | HASH GROUP BY | | 1 | 71 | 29809 (2)| 00:05:58 |
| 11 | VIEW | | 1 | 71 | 29809 (2)| 00:05:58 |
|* 12 | FILTER | | | | | |
| 13 | HASH GROUP BY | | 1 | 198 | 29809 (2)| 00:05:58 |
| 14 | NESTED LOOPS | | 1 | 198 | 29806 (2)| 00:05:58 |
|* 15 | HASH JOIN | | 1 | 171 | 29805 (2)| 00:05:58 |
|* 16 | HASH JOIN | | 4 | 572 | 29802 (2)| 00:05:58 |
|* 17 | TABLE ACCESS FULL | REC_SM_STDNT_DEG_COMPLETION | 4 | 452 | 29798 (2)| 00:05:58 |
| 18 | INDEX FAST FULL SCAN | PS2RQ_MAIN_TBL | 1035 | 31050 | 3 (0)| 00:00:01 |
| 19 | INDEX FAST FULL SCAN | PS2RQ_MAIN_TBL | 1035 | 28980 | 3 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 27 | 1 (0)| 00:00:01 |
| 21 | SORT AGGREGATE | | 1 | 15 | | |
| 22 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 23 | INDEX RANGE SCAN (MIN/MAX)| PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
| 24 | VIEW | | 1 | 58 | 29813 (2)| 00:05:58 |
| 25 | HASH GROUP BY | | 1 | 45 | 29813 (2)| 00:05:58 |
| 26 | VIEW | | 1 | 45 | 29813 (2)| 00:05:58 |
|* 27 | FILTER | | | | | |
| 28 | HASH GROUP BY | | 1 | 199 | 29813 (2)| 00:05:58 |
| 29 | NESTED LOOPS | | 1 | 199 | 29810 (2)| 00:05:58 |
|* 30 | HASH JOIN | | 1 | 172 | 29809 (2)| 00:05:58 |
|* 31 | HASH JOIN | | 8 | 1152 | 29805 (2)| 00:05:58 |
|* 32 | TABLE ACCESS FULL | REC_SM_STDNT_DEG_COMPLETION | 7 | 798 | 29802 (2)| 00:05:58 |
| 33 | INDEX FAST FULL SCAN | PS2RQ_MAIN_TBL | 1035 | 31050 | 3 (0)| 00:00:01 |
| 34 | INDEX FAST FULL SCAN | PS2RQ_MAIN_TBL | 1035 | 28980 | 3 (0)| 00:00:01 |
|* 35 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 27 | 1 (0)| 00:00:01 |
| 36 | SORT AGGREGATE | | 1 | 15 | | |
| 37 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 38 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
|* 39 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 18 | 1 (0)| 00:00:01 |
| 40 | SORT AGGREGATE | | 1 | 18 | | |
| 41 | FIRST ROW | | 1 | 18 | 2 (0)| 00:00:01 |
|* 42 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_MAIN_TBL | 1 | 18 | 2 (0)| 00:00:01 |
|* 43 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 15 | 1 (0)| 00:00:01 |
| 44 | SORT AGGREGATE | | 1 | 15 | | |
| 45 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 46 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
call count cpu elapsed disk query current rows
Parse 1 1.49 1.51 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 18.25 28.63 463672 932215 0 836
total 4 19.75 30.15 463672 932215 0 836
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
db file scattered read 14262 0.31 13.13
latch: shared pool 1 0.01 0.01
db file sequential read 7 0.00 0.00
direct path write temp 493 0.00 0.00
direct path read temp 493 0.00 0.00
SQL*Net more data to client 40 0.00 0.00
SQL*Net message from client 2 0.83 1.23
********************************************************************************Edited by: ngilbert on Jun 26, 2012 4:40 PM
Edited by: ngilbert on Jun 26, 2012 4:41 PMSorry - you're right, no significance, very new to this - based on this article i assumed the hash algorithm to get SQL_ID from SQL text would be the same across different instances:
http://blog.tanelpoder.com/2009/02/22/sql_id-is-just-a-fancy-representation-of-hash-value/
Trying again:
Current environment, 10.2.0.4, 30 seconds for all rows, explain plan with predicate information
PLAN_TABLE_OUTPUT
Plan hash value: 2178773127
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 331 | 89446 (2)| 00:17:54 |
| 1 | SORT UNIQUE | | 1 | 331 | 89445 (2)| 00:17:54 |
| 2 | NESTED LOOPS | | 1 | 331 | 89440 (2)| 00:17:54 |
| 3 | NESTED LOOPS | | 1 | 316 | 89439 (2)| 00:17:54 |
|* 4 | HASH JOIN OUTER | | 1 | 298 | 89438 (2)| 00:17:54 |
|* 5 | HASH JOIN OUTER | | 1 | 240 | 59625 (2)| 00:11:56 |
| 6 | NESTED LOOPS | | 1 | 182 | 29815 (2)| 00:05:58 |
|* 7 | TABLE ACCESS FULL | REC_SM_STDNT_DEG_COMPLETION | 1 | 167 | 29814 (2)| 00:05:58 |
|* 8 | INDEX FULL SCAN | PS0SMO_RDR_IMP_PLN | 1 | 15 | 1 (0)| 00:00:01 |
| 9 | VIEW | | 1 | 58 | 29809 (2)| 00:05:58 |
| 10 | HASH GROUP BY | | 1 | 71 | 29809 (2)| 00:05:58 |
| 11 | VIEW | | 1 | 71 | 29809 (2)| 00:05:58 |
|* 12 | FILTER | | | | | |
| 13 | HASH GROUP BY | | 1 | 198 | 29809 (2)| 00:05:58 |
| 14 | NESTED LOOPS | | 1 | 198 | 29806 (2)| 00:05:58 |
|* 15 | HASH JOIN | | 1 | 171 | 29805 (2)| 00:05:58 |
|* 16 | HASH JOIN | | 4 | 572 | 29802 (2)| 00:05:58 |
|* 17 | TABLE ACCESS FULL | REC_SM_STDNT_DEG_COMPLETION | 4 | 452 | 29798 (2)| 00:05:58 |
| 18 | INDEX FAST FULL SCAN | PS2RQ_MAIN_TBL | 1035 | 31050 | 3 (0)| 00:00:01 |
| 19 | INDEX FAST FULL SCAN | PS2RQ_MAIN_TBL | 1035 | 28980 | 3 (0)| 00:00:01 |
|* 20 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 27 | 1 (0)| 00:00:01 |
| 21 | SORT AGGREGATE | | 1 | 15 | | |
| 22 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 23 | INDEX RANGE SCAN (MIN/MAX)| PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
| 24 | VIEW | | 1 | 58 | 29813 (2)| 00:05:58 |
| 25 | HASH GROUP BY | | 1 | 45 | 29813 (2)| 00:05:58 |
| 26 | VIEW | | 1 | 45 | 29813 (2)| 00:05:58 |
|* 27 | FILTER | | | | | |
| 28 | HASH GROUP BY | | 1 | 199 | 29813 (2)| 00:05:58 |
| 29 | NESTED LOOPS | | 1 | 199 | 29810 (2)| 00:05:58 |
|* 30 | HASH JOIN | | 1 | 172 | 29809 (2)| 00:05:58 |
|* 31 | HASH JOIN | | 8 | 1152 | 29805 (2)| 00:05:58 |
|* 32 | TABLE ACCESS FULL | REC_SM_STDNT_DEG_COMPLETION | 7 | 798 | 29802 (2)| 00:05:58 |
| 33 | INDEX FAST FULL SCAN | PS2RQ_MAIN_TBL | 1035 | 31050 | 3 (0)| 00:00:01 |
| 34 | INDEX FAST FULL SCAN | PS2RQ_MAIN_TBL | 1035 | 28980 | 3 (0)| 00:00:01 |
|* 35 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 27 | 1 (0)| 00:00:01 |
| 36 | SORT AGGREGATE | | 1 | 15 | | |
| 37 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 38 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
|* 39 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 18 | 1 (0)| 00:00:01 |
| 40 | SORT AGGREGATE | | 1 | 18 | | |
| 41 | FIRST ROW | | 1 | 18 | 2 (0)| 00:00:01 |
|* 42 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_MAIN_TBL | 1 | 18 | 2 (0)| 00:00:01 |
|* 43 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 15 | 1 (0)| 00:00:01 |
| 44 | SORT AGGREGATE | | 1 | 15 | | |
| 45 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 46 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("A"."EMPLID"="C"."EMPLID"(+) AND "A"."ACAD_CAREER"="C"."ACAD_CAREER"(+) AND
"A"."ACAD_PLAN"="C"."ACAD_PLAN"(+) AND "A"."REQ_ACAD_PLAN"="C"."REQ_ACAD_PLAN"(+) AND
"A"."ACADEMIC_LEVEL"="C"."ACADEMIC_LEVEL"(+) AND "A"."REQ_TERM"="C"."REQ_TERM"(+) AND
"A"."RQRMNT_GROUP"="C"."RQRMNT_GROUP"(+))
5 - access("A"."EMPLID"="B"."EMPLID"(+) AND "A"."ACAD_CAREER"="B"."ACAD_CAREER"(+) AND
"A"."ACAD_PLAN"="B"."ACAD_PLAN"(+) AND "A"."REQ_ACAD_PLAN"="B"."REQ_ACAD_PLAN"(+) AND
"A"."ACADEMIC_LEVEL"="B"."ACADEMIC_LEVEL"(+) AND "A"."REQ_TERM"="B"."REQ_TERM"(+) AND
"A"."RQRMNT_GROUP"="B"."RQRMNT_GROUP"(+))
7 - filter("A"."ACAD_PLAN"="A"."REQ_ACAD_PLAN" AND "A"."ACAD_PROG"='UBACH' AND "A"."ACAD_CAREER"='UGRD' AND
"A"."IMPACT_FLAG"='Y' AND "A"."REQUIREMENT" IS NOT NULL AND (SYS_OP_C2C("A"."REQ_ACAD_PLAN")=U'NUPPXXXBBS'
OR
SYS_OP_C2C("A"."REQ_ACAD_PLAN")=U'NURPBASBBS' OR SYS_OP_C2C("A"."REQ_ACAD_PLAN")=U'NURPXXXBBS') AND
(SYS_OP_C2C("A"."ACAD_PLAN")=U'NUPPXXXBBS' OR SYS_OP_C2C("A"."ACAD_PLAN")=U'NURPBASBBS' OR
SYS_OP_C2C("A"."ACAD_PLAN")=U'NURPXXXBBS') AND (SYS_OP_C2C("A"."ACADEMIC_LEVEL")=U'10' OR
SYS_OP_C2C("A"."ACADEMIC_LEVEL")=U'20' OR SYS_OP_C2C("A"."ACADEMIC_LEVEL")=U'30' OR
SYS_OP_C2C("A"."ACADEMIC_LEVEL")=U'40' OR SYS_OP_C2C("A"."ACADEMIC_LEVEL")=U'50' OR
SYS_OP_C2C("A"."ACADEMIC_LEVEL")=U'GR'))
8 - access("D"."ACAD_PLAN"="A"."REQ_ACAD_PLAN")
filter((SYS_OP_C2C("D"."ACAD_PLAN")=U'NUPPXXXBBS' OR SYS_OP_C2C("D"."ACAD_PLAN")=U'NURPBASBBS' OR
SYS_OP_C2C("D"."ACAD_PLAN")=U'NURPXXXBBS') AND "D"."ACAD_PLAN"="A"."REQ_ACAD_PLAN")
12 - filter("M3"."EFFDT"=MAX("M3_ED"."EFFDT"))
15 - access("M3_ED"."REQUIREMENT"="M3"."REQUIREMENT")
filter("M3_ED"."EFFDT"<="B_SUB"."REQ_TERM_BEGIN_DATE")
16 - access("M3"."REQUIREMENT"="B_SUB"."REQUIREMENT")
17 - filter("B_SUB"."REQ_ACAD_PLAN" IS NOT NULL AND "B_SUB"."ACAD_PLAN"="B_SUB"."REQ_ACAD_PLAN" AND
"B_SUB"."ACAD_PROG"='UBACH' AND "B_SUB"."ACAD_CAREER"='UGRD' AND "B_SUB"."IMPACT_FLAG"='Y' AND
"B_SUB"."REQUIREMENT" IS NOT NULL AND "B_SUB"."GRADE"<>'IP')
20 - access("G3"."RQRMNT_GROUP"="B_SUB"."RQRMNT_GROUP")
filter("G3"."EFFDT"= (SELECT MAX("G3_ED"."EFFDT") FROM "HRSA_EXTR"."PS_RQ_GRP_TBL" "G3_ED" WHERE
"G3_ED"."EFFDT"<=:B1 AND "G3_ED"."RQRMNT_GROUP"=:B2))
23 - access("G3_ED"."RQRMNT_GROUP"=:B1 AND "G3_ED"."EFFDT"<=:B2)
27 - filter("M2"."EFFDT"=MAX("M2_ED"."EFFDT"))
30 - access("M2_ED"."REQUIREMENT"="M2"."REQUIREMENT")
filter("M2_ED"."EFFDT"<="C_SUB"."REQ_TERM_BEGIN_DATE")
31 - access("M2"."REQUIREMENT"="C_SUB"."REQUIREMENT")
32 - filter("C_SUB"."ACAD_PLAN"="C_SUB"."REQ_ACAD_PLAN" AND "C_SUB"."ACAD_PROG"='UBACH' AND
"C_SUB"."RQRMNT_LINE_STATUS"='COMP' AND "C_SUB"."IMPACT_FLAG"='Y' AND "C_SUB"."ACAD_CAREER"='UGRD' AND
"C_SUB"."REQUIREMENT" IS NOT NULL AND "C_SUB"."GRADE"<>'IP')
35 - access("G2"."RQRMNT_GROUP"="C_SUB"."RQRMNT_GROUP")
filter("G2"."EFFDT"= (SELECT MAX("G2_ED"."EFFDT") FROM "HRSA_EXTR"."PS_RQ_GRP_TBL" "G2_ED" WHERE
"G2_ED"."EFFDT"<=:B1 AND "G2_ED"."RQRMNT_GROUP"=:B2))
38 - access("G2_ED"."RQRMNT_GROUP"=:B1 AND "G2_ED"."EFFDT"<=:B2)
39 - access("M"."REQUIREMENT"="A"."REQUIREMENT")
filter("M"."EFFDT"= (SELECT MAX("M_ED"."EFFDT") FROM "HRSA_EXTR"."PS_RQ_MAIN_TBL" "M_ED" WHERE
"M_ED"."EFFDT"<=:B1 AND "M_ED"."REQUIREMENT"=:B2))
42 - access("M_ED"."REQUIREMENT"=:B1 AND "M_ED"."EFFDT"<=:B2)
43 - access("G"."RQRMNT_GROUP"="A"."RQRMNT_GROUP")
filter("G"."EFFDT"= (SELECT MAX("G_ED"."EFFDT") FROM "HRSA_EXTR"."PS_RQ_GRP_TBL" "G_ED" WHERE
"G_ED"."EFFDT"<=:B1 AND "G_ED"."RQRMNT_GROUP"=:B2))
46 - access("G_ED"."RQRMNT_GROUP"=:B1 AND "G_ED"."EFFDT"<=:B2)
106 rows selected.New environment, 11.2.0.2, 4000 seconds for all rows:
PLAN_TABLE_OUTPUT
Plan hash value: 4117596694
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 314 | 15231 (1)| 00:03:03 |
| 1 | SORT UNIQUE | | 1 | 314 | 15230 (1)| 00:03:03 |
| 2 | NESTED LOOPS OUTER | | 1 | 314 | 15227 (1)| 00:03:03 |
| 3 | NESTED LOOPS OUTER | | 1 | 285 | 15216 (1)| 00:03:03 |
| 4 | NESTED LOOPS | | 1 | 256 | 15205 (1)| 00:03:03 |
| 5 | NESTED LOOPS | | 1 | 241 | 15204 (1)| 00:03:03 |
| 6 | NESTED LOOPS | | 1 | 223 | 15203 (1)| 00:03:03 |
| 7 | NESTED LOOPS | | 17 | 731 | 15186 (1)| 00:03:03 |
| 8 | VIEW | VW_SQ_3 | 998 | 27944 | 15186 (1)| 00:03:03 |
| 9 | HASH GROUP BY | | 998 | 62874 | 15186 (1)| 00:03:03 |
| 10 | MERGE JOIN | | 29060 | 1787K| 15184 (1)| 00:03:03 |
| 11 | SORT JOIN | | 26 | 1248 | 15180 (1)| 00:03:03 |
| 12 | TABLE ACCESS BY INDEX ROWID | REC_SM_STDNT_DEG_COMPLETION | 26 | 1248 | 15179 (1)| 00:03:03 |
|* 13 | INDEX SKIP SCAN | REC0SM_STDNT_DEG_IDX | 26 | | 15168 (1)| 00:03:03 |
|* 14 | SORT JOIN | | 1217 | 18255 | 4 (25)| 00:00:01 |
| 15 | INDEX FAST FULL SCAN | PS3RQ_GRP_TBL | 1217 | 18255 | 3 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | PS_RQ_GRP_TBL | 1 | 15 | 0 (0)| 00:00:01 |
|* 17 | TABLE ACCESS BY USER ROWID | REC_SM_STDNT_DEG_COMPLETION | 1 | 180 | 1 (0)| 00:00:01 |
|* 18 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 18 | 1 (0)| 00:00:01 |
| 19 | SORT AGGREGATE | | 1 | 18 | | |
| 20 | FIRST ROW | | 1 | 18 | 2 (0)| 00:00:01 |
|* 21 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_MAIN_TBL | 1 | 18 | 2 (0)| 00:00:01 |
|* 22 | INDEX FULL SCAN | PS0SMO_RDR_IMP_PLN | 1 | 15 | 1 (0)| 00:00:01 |
|* 23 | VIEW PUSHED PREDICATE | | 1 | 29 | 11 (19)| 00:00:01 |
| 24 | SORT GROUP BY | | 1 | 52 | 11 (19)| 00:00:01 |
| 25 | VIEW | VM_NWVW_5 | 1 | 52 | 10 (10)| 00:00:01 |
|* 26 | FILTER | | | | | |
| 27 | SORT GROUP BY | | 1 | 165 | 10 (10)| 00:00:01 |
|* 28 | FILTER | | | | | |
| 29 | NESTED LOOPS | | 1 | 165 | 7 (0)| 00:00:01 |
| 30 | NESTED LOOPS | | 1 | 147 | 6 (0)| 00:00:01 |
| 31 | NESTED LOOPS | | 1 | 117 | 5 (0)| 00:00:01 |
|* 32 | TABLE ACCESS BY INDEX ROWID | REC_SM_STDNT_DEG_COMPLETION | 1 | 90 | 4 (0)| 00:00:01 |
|* 33 | INDEX RANGE SCAN | REC1SM_STDNT_DEG_IDX | 1 | | 3 (0)| 00:00:01 |
|* 34 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 27 | 1 (0)| 00:00:01 |
| 35 | SORT AGGREGATE | | 1 | 15 | | |
| 36 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 37 | INDEX RANGE SCAN (MIN/MAX)| PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
|* 38 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 30 | 1 (0)| 00:00:01 |
|* 39 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 18 | 1 (0)| 00:00:01 |
|* 40 | VIEW PUSHED PREDICATE | | 1 | 29 | 11 (19)| 00:00:01 |
| 41 | SORT GROUP BY | | 1 | 32 | 11 (19)| 00:00:01 |
| 42 | VIEW | VM_NWVW_4 | 1 | 32 | 10 (10)| 00:00:01 |
|* 43 | FILTER | | | | | |
| 44 | SORT GROUP BY | | 1 | 166 | 10 (10)| 00:00:01 |
|* 45 | FILTER | | | | | |
|* 46 | FILTER | | | | | |
| 47 | NESTED LOOPS | | 1 | 166 | 7 (0)| 00:00:01 |
| 48 | NESTED LOOPS | | 1 | 148 | 6 (0)| 00:00:01 |
| 49 | NESTED LOOPS | | 1 | 118 | 5 (0)| 00:00:01 |
|* 50 | INDEX RANGE SCAN | PS_RQ_GRP_TBL | 1 | 27 | 2 (0)| 00:00:01 |
|* 51 | TABLE ACCESS BY INDEX ROWID | REC_SM_STDNT_DEG_COMPLETION | 1 | 91 | 3 (0)| 00:00:01 |
|* 52 | INDEX RANGE SCAN | REC1SM_STDNT_DEG_IDX | 1 | | 2 (0)| 00:00:01 |
|* 53 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 30 | 1 (0)| 00:00:01 |
|* 54 | INDEX RANGE SCAN | PS_RQ_MAIN_TBL | 1 | 18 | 1 (0)| 00:00:01 |
| 55 | SORT AGGREGATE | | 1 | 15 | | |
| 56 | FIRST ROW | | 1 | 15 | 2 (0)| 00:00:01 |
|* 57 | INDEX RANGE SCAN (MIN/MAX) | PS_RQ_GRP_TBL | 1 | 15 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
13 - access("A"."ACAD_CAREER"='UGRD' AND "A"."ACAD_PROG"='UBACH' AND "A"."IMPACT_FLAG"='Y')
filter("A"."ACAD_PLAN"="A"."REQ_ACAD_PLAN" AND "A"."ACAD_PROG"='UBACH' AND "A"."IMPACT_FLAG"='Y' AND
"A"."ACAD_CAREER"='UGRD')
14 - access(INTERNAL_FUNCTION("G_ED"."EFFDT")<=INTERNAL_FUNCTION("A"."REQ_TERM_BEGIN_DATE"))
filter(INTERNAL_FUNCTION("G_ED"."EFFDT")<=INTERNAL_FUNCTION("A"."REQ_TERM_BEGIN_DATE"))
16 - access("ITEM_5"="G"."RQRMNT_GROUP" AND "G"."EFFDT"="MAX(G_ED.EFFDT)")
17 - filter("SYS_ALIAS_2"."ACAD_PLAN"="SYS_ALIAS_2"."REQ_ACAD_PLAN" AND "SYS_ALIAS_2"."ACAD_PROG"='UBACH' AND
"SYS_ALIAS_2"."ACAD_CAREER"='UGRD' AND "SYS_ALIAS_2"."IMPACT_FLAG"='Y' AND "SYS_ALIAS_2"."REQUIREMENT" IS N
OT
NULL AND (SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NUPPXXXBBS' OR
SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NURPBASBBS' OR
SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NURPXXXBBS') AND
(SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NUPPXXXBBS' OR SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NURPBASBBS'
OR
SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NURPXXXBBS') AND (SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'10'
OR
SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'20' OR SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'30' OR
SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'40' OR SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'50' OR
SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'GR') AND "G"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP")
18 - access("M"."REQUIREMENT"="SYS_ALIAS_2"."REQUIREMENT")
filter("M"."EFFDT"= (SELECT MAX("M_ED"."EFFDT") FROM "HRSA_EXTR"."PS_RQ_MAIN_TBL" "M_ED" WHERE
"M_ED"."EFFDT"<=:B1 AND "M_ED"."REQUIREMENT"=:B2))
21 - access("M_ED"."REQUIREMENT"=:B1 AND "M_ED"."EFFDT"<=:B2)
22 - access("D"."ACAD_PLAN"="SYS_ALIAS_2"."REQ_ACAD_PLAN")
filter((SYS_OP_C2C("D"."ACAD_PLAN")=U'NUPPXXXBBS' OR SYS_OP_C2C("D"."ACAD_PLAN")=U'NURPBASBBS' OR
SYS_OP_C2C("D"."ACAD_PLAN")=U'NURPXXXBBS') AND "D"."ACAD_PLAN"="SYS_ALIAS_2"."REQ_ACAD_PLAN")
23 - filter("SYS_ALIAS_2"."REQ_TERM"="B"."REQ_TERM"(+))
26 - filter("M3"."EFFDT"=MAX("M3_ED"."EFFDT"))
28 - filter('UGRD'="SYS_ALIAS_2"."ACAD_CAREER" AND "SYS_ALIAS_2"."REQ_ACAD_PLAN"="SYS_ALIAS_2"."ACAD_PLAN")
32 - filter("SYS_ALIAS_2"."REQ_ACAD_PLAN" IS NOT NULL AND
"SYS_ALIAS_2"."REQ_ACAD_PLAN"="SYS_ALIAS_2"."REQ_ACAD_PLAN" AND
"SYS_ALIAS_2"."ACADEMIC_LEVEL"="SYS_ALIAS_2"."ACADEMIC_LEVEL" AND "SYS_ALIAS_2"."IMPACT_FLAG"='Y' AND
"SYS_ALIAS_2"."REQUIREMENT" IS NOT NULL AND (SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NUPPXXXBBS' OR
SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NURPBASBBS' OR
SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NURPXXXBBS') AND (SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'
10'
OR SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'20' OR SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'30' OR
SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'40' OR SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'50' OR
SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'GR') AND "SYS_ALIAS_2"."GRADE"<>'IP')
33 - access("SYS_ALIAS_2"."EMPLID"="SYS_ALIAS_2"."EMPLID" AND
"SYS_ALIAS_2"."ACAD_PLAN"="SYS_ALIAS_2"."REQ_ACAD_PLAN" AND "SYS_ALIAS_2"."ACAD_CAREER"='UGRD' AND
"SYS_ALIAS_2"."ACAD_PROG"='UBACH' AND "SYS_ALIAS_2"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP")
filter("SYS_ALIAS_2"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP" AND "SYS_ALIAS_2"."ACAD_PROG"='UBACH'
AND "SYS_ALIAS_2"."ACAD_CAREER"='UGRD' AND (SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NUPPXXXBBS' OR
SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NURPBASBBS' OR SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NURPXXXBBS')
34 - access("G3"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP")
filter("G3"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP" AND "G3"."EFFDT"= (SELECT MAX("G3_ED"."EFFDT")
FROM "HRSA_EXTR"."PS_RQ_GRP_TBL" "G3_ED" WHERE "G3_ED"."EFFDT"<=:B1 AND "G3_ED"."RQRMNT_GROUP"=:B2))
37 - access("G3_ED"."RQRMNT_GROUP"=:B1 AND "G3_ED"."EFFDT"<=:B2)
38 - access("M3"."REQUIREMENT"="SYS_ALIAS_2"."REQUIREMENT")
39 - access("M3_ED"."REQUIREMENT"="M3"."REQUIREMENT" AND "M3_ED"."EFFDT"<="B_SUB"."REQ_TERM_BEGIN_DATE")
40 - filter("SYS_ALIAS_2"."REQ_TERM"="C"."REQ_TERM"(+))
43 - filter("M2"."EFFDT"=MAX("M2_ED"."EFFDT"))
45 - filter("G2"."EFFDT"= (SELECT MAX("G2_ED"."EFFDT") FROM "HRSA_EXTR"."PS_RQ_GRP_TBL" "G2_ED" WHERE
"G2_ED"."EFFDT"<=:B1 AND "G2_ED"."RQRMNT_GROUP"=:B2))
46 - filter('UGRD'="SYS_ALIAS_2"."ACAD_CAREER" AND "SYS_ALIAS_2"."REQ_ACAD_PLAN"="SYS_ALIAS_2"."ACAD_PLAN")
50 - access("G2"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP")
51 - filter("SYS_ALIAS_2"."REQ_ACAD_PLAN"="SYS_ALIAS_2"."REQ_ACAD_PLAN" AND
"SYS_ALIAS_2"."ACADEMIC_LEVEL"="SYS_ALIAS_2"."ACADEMIC_LEVEL" AND "SYS_ALIAS_2"."RQRMNT_LINE_STATUS"='COMP'
AND
"SYS_ALIAS_2"."IMPACT_FLAG"='Y' AND "SYS_ALIAS_2"."REQUIREMENT" IS NOT NULL AND
(SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NUPPXXXBBS' OR
SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NURPBASBBS' OR
SYS_OP_C2C("SYS_ALIAS_2"."REQ_ACAD_PLAN")=U'NURPXXXBBS') AND (SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'
10'
OR SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'20' OR SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'30' OR
SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'40' OR SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'50' OR
SYS_OP_C2C("SYS_ALIAS_2"."ACADEMIC_LEVEL")=U'GR') AND "SYS_ALIAS_2"."GRADE"<>'IP')
52 - access("SYS_ALIAS_2"."EMPLID"="SYS_ALIAS_2"."EMPLID" AND
"SYS_ALIAS_2"."ACAD_PLAN"="SYS_ALIAS_2"."REQ_ACAD_PLAN" AND "SYS_ALIAS_2"."ACAD_CAREER"='UGRD' AND
"SYS_ALIAS_2"."ACAD_PROG"='UBACH' AND "SYS_ALIAS_2"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP")
filter("SYS_ALIAS_2"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP" AND "SYS_ALIAS_2"."ACAD_PROG"='UBACH'
AND "SYS_ALIAS_2"."ACAD_CAREER"='UGRD' AND (SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NUPPXXXBBS' OR
SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NURPBASBBS' OR SYS_OP_C2C("SYS_ALIAS_2"."ACAD_PLAN")=U'NURPXXXBBS')
AND
"G2"."RQRMNT_GROUP"="SYS_ALIAS_2"."RQRMNT_GROUP")
53 - access("M2"."REQUIREMENT"="SYS_ALIAS_2"."REQUIREMENT")
54 - access("M2_ED"."REQUIREMENT"="M2"."REQUIREMENT" AND "M2_ED"."EFFDT"<="C_SUB"."REQ_TERM_BEGIN_DATE")
57 - access("G2_ED"."RQRMNT_GROUP"=:B1 AND "G2_ED"."EFFDT"<=:B2)Edited by: ngilbert on Jun 26, 2012 5:00 PM
Edited by: ngilbert on Jun 26, 2012 5:05 PM -
Pls help me to modify the query for performance improvement
Hi,
I have the below initialization
DECLARE @Active bit =1 ;
Declare @id int
SELECT @Active=CASE WHEN id=@id and [Rank] ='Good' then 0 else 1 END FROM dbo.Students
I have to change this query in such a way that the conditions id=@id and [Rank] ='Good' should go to the where condition of the query. In that case, how can i use Case statement to retrieve 1 or 0? Can you please help me to modify this initialization?I dont understand your query...May be below? or provide us sample data and your output...
SELECT * FROM dbo.students
where @Active=CASE
WHEN id=@id and rank ='Good' then 0 else 1 END
But, I doubt you will have performance improvement here?
Do you have index on id?
If you are looking for getting the data for @ID with rank ='Good' then use the below:Make sure, you have index on id,rank combination.
SELECT * FROM dbo.students
where id=@id
and rank ='Good' -
Regarding "select query" on performance basis..
Hi Experts,
I am creating an ALV report,so that i have to collect all data in 1 internal table.
I have to collect data from 3 standard tables i.e.T157E,MSEG,MKPF.
For all entries of T157E, i have to fetch data from MSEG.
But in where condition i have to give POSTING DATE n this field is in MKPF.
Also Database performance analysis is around 98%.
How can i give better performance, please help..
Below is my coding...
(second select query is taking too much time,how can i rectify)
SELECT BWART
GRUND
FROM T157D
INTO CORRESPONDING FIELDS OF TABLE IT_MOV_TYPE.
SELECT MATNR
MJAHR
MBLNR
BWART
WERKS
LGORT
CHARG
GRUND
MENGE
MEINS
FROM MSEG
INTO CORRESPONDING FIELDS OF TABLE IT_MSEG
FOR ALL ENTRIES IN IT_MOV_TYPE
WHERE GRUND = IT_MOV_TYPE-GRUND
AND BWART = IT_MOV_TYPE-BWART
AND WERKS = PLANT
AND LGORT IN ST_L.
SORT IT_MSEG BY MBLNR.
LOOP AT IT_MSEG.
AT NEW MBLNR.
SELECT SINGLE BUDAT
FROM MKPF
INTO V_BUDAT
WHERE MBLNR = IT_MSEG-MBLNR
AND MJAHR = IT_MSEG-MJAHR.
SELECT SINGLE MAKTX
FROM MAKT
INTO V_MAKTX
WHERE MATNR = IT_MSEG-MATNR.
SELECT SINGLE GRTXT
FROM T157E
INTO V_GRTXT
WHERE GRUND = IT_MSEG-GRUND.
ENDAT.
IT_MSEG-BUDAT = V_BUDAT.
IT_MSEG-MAKTX = V_MAKTX.
IT_MSEG-GRTXT = V_GRTXT.
MODIFY IT_MSEG.
ENDLOOP.
Regards,
AnkurBefore you use
FOR ALL ENTRIES IN
Do the following :
1. Sort the Internal table used in the 'FOR ALL ENTRIES IN' clause.
2. Make sure they do not contain duplicates.
3. Last and most importantly include a primary key field(Unique entry) in the select list. The reason, the system gets unique field records based on the where condition. It summarizes the data based on the Data type and field list in the target internal table.
One should be sure the internal table, used in the FOR ALL ENTRIES clause is not empty. If the table is empty, ALL ENTRIES will be selected. (Actually, all WHERE clauses are neglected). Of course, you should also be sure you select on INDEX fields. Otherwise the use of FOR ALL ENTRIES increases the runtime instead of improving it. -
Query giving performance issues.
Hi All,
Following query is giving performance issues. Query execution is taking around 11 minutes. Our client requirement is to get the data for the query in 30 sec to 1 min. Please suggest.
SELECT
DISTINCT r.rptid, p.product_id, p.vnd_dscr, p.vendor_cd, p.Firm_Cd, a.is_mm_sweep IsMoneyMarket
FROM
dev.ac_cube a,
dev.rpt_master_rep_list_view r,
dev.cur_ps_cube p
WHERE a.repid = r.rep_id
AND a.accountkey = p.accountkey
AND p.product_id IS NOT NULL
AND p.product_id != 'CASH'
AND r.RPTID = '42817'
Number of distinct records fetched by above query : 34445
Number of records in dev.ac_cube table : 13.6 million
Number of records in dev.cur_ps_cube table : 7 million
Number of records in dev.rpt_master_rep_list_view for RPTID '42817' : 118354
repid, product_id is indexed column in dev.ac_cube table. accountkey is primary key in dev.ac_cube table.
rep_id is indexed column in base table on which dev.rpt_master_rep_list_view view is createdThe output is not complete as i expected. Have you followed the steps I have mentioned in my earlier post
Also when posting output enclose between two {*code*} ...{*code*} (remove * within braces). It displays everything between the tags as proper formatted output otherwise its really hard to read and understand
See sample below. However you need to get the session id, sql id, display_cursor output exactly in same way as mentioned in my previous post
SQL> set arraysize 200 timing on serveroutput on linesize 200;
SQL> set autotrace traceonly explain statistics;
SQL> select level from dual connect by level <= 10000;
10000 rows selected.
Elapsed: 00:00:00.09
Execution Plan
Plan hash value: 1236776825
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 (0)| 00:00:01 |
| 1 | CONNECT BY WITHOUT FILTERING| | | | |
| 2 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
Statistics
1 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
57406 bytes sent via SQL*Net to client
919 bytes received via SQL*Net from client
51 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
10000 rows processed
SQL>
{code} -
The query is performing very very slow, can any one please help me tue this
SELECT h.ROWID row_id, e.preparer_user_id
FROM arsarc.ars_sv_reconciliation e,
arsarc.ars_sv_reconciliation_accts a,
arsarc.ars_sv_acct_status_history h
WHERE e.rec_id = :b1
AND e.rec_id = a.rec_id
AND e.ledger_id = h.ledger_id
AND a.ccid = h.ccid
AND e.preparer_user_id <> h.preparer_user_id
AND h.fiscal_year + h.fiscal_period >= e.fiscal_year + e.fiscal_period
PLAN_TABLE_OUTPUT
Plan hash value: 2851427911
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 60 | 7740 | 6282 (11)| 00:00:08 |
|* 1 | HASH JOIN | | 60 | 7740 | 6282 (11)| 00:00:08 |
|* 2 | INDEX RANGE SCAN | PK_RECONCILIATION_ACCTS | 104 | 4160 | 3 (0)| 00:00:01 |
| 3 | NESTED LOOPS | | 178K| 15M| 6243 (10)| 00:00:08 |
| 4 | TABLE ACCESS BY INDEX ROWID| ARS_SV_RECONCILIATION | 1 | 23 | 2 (0)| 00:00:01 |
|* 5 | INDEX UNIQUE SCAN | PK_ARS_SV_RECONCILIATION | 1 | | 1 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
|* 6 | TABLE ACCESS BY INDEX ROWID| ARS_SV_ACCT_STATUS_HISTORY | 178K| 11M| 6241 (10)| 00:00:08 |
|* 7 | INDEX RANGE SCAN | ARS_SV_ACCT_STATUS_HISTORY$LPY | 62094 | | 5243 (11)| 00:00:07 |
Predicate Information (identified by operation id):
1 - access("A"."CCID"="H"."CCID")
2 - access("A"."REC_ID"=TO_NUMBER(:B1))
5 - access("E"."REC_ID"=TO_NUMBER(:B1))
6 - filter("E"."PREPARER_USER_ID"<>"H"."PREPARER_USER_ID")
PLAN_TABLE_OUTPUT
7 - access("E"."LEDGER_ID"="H"."LEDGER_ID")
filter("H"."FISCAL_YEAR"+"H"."FISCAL_PERIOD">="E"."FISCAL_YEAR"+"E"."FISCAL_PERIOD")Hi,
the plan isn't showing any problem (the cost isn't high) so it's not possible to use it to troublehshoot the query. Please provide more information: 4-digit Oracle version, and depending on the version, either SQL real-time monitor report or dbms_xplan output with rowsource stats (option "iostats last" after running your sql with ALTER SESSION SET STATISTICS_LEVEL = ALL).
Also, when reporting a performance problem it would be wise to avoid expressions like "very, very slow" replacing them with something more useful like "my query is taking 2.5 hours to retrieve 30k rows".
Best regards,
Nikolay -
SQL Query Having performance issues
I need help on rewriting this query, I am having performance issues with the way it is now. I create a temporary table and query against it. Any help will be appreciated. Thanks, Antonio
Here it is:
create global temporary table pr_php_elig_tmp
on commit preserve rows as
SELECT UNIQUE A.SAK_PROV, A.CDE_SERVICE_LOC, a.sak_short
FROM T_PR_PHP_ELIG A,
T_PR_TYPE C
WHERE C.SAK_PROV = A.SAK_PROV
AND C.CDE_SERVICE_LOC = A.CDE_SERVICE_LOC
AND C.CDE_PROV_TYPE not in ('01', '03', '08', '24', '27', '31')
AND A.SAK_PROV_PGM not in (11, 13)
AND A.DTE_END >= :il_current_date
AND A.DTE_EFFECTIVE <= :il_prev_18_months
AND NOT EXISTS (
SELECT 'X'
FROM T_PR_GRP_MBR T
WHERE T.SAK_PROV = A.SAK_PROV
AND T.CDE_SVC_LOC_MBR = A.CDE_SERVICE_LOC)
AND NOT EXISTS (
select a.sak_prov, a.cde_service_loc
from t_pmp_svc_loc d
where a.sak_prov = d.sak_prov
and a.cde_service_loc = d.cde_service_loc
and d.dte_end >= :il_current_date)
ORDER BY A.SAK_PROV, A.CDE_SERVICE_LOC;
select * from pr_php_elig_tmp
minus
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_dntl_dtl temp01
WHERE temp01.sak_prov_perf = a.sak_prov
and temp01.cde_svc_loc_perf = a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp01.DTE_FIRST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp01.DTE_FIRST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_dntl_hdr temp02
WHERE ( (temp02.prov_billing = a.sak_prov
and temp02.cde_service_loc = a.cde_service_loc)
OR (temp02.sak_prov_perf = a.sak_prov
and temp02.cde_perf_svc_loc = a.cde_service_loc)
OR (temp02.sak_prov_referring = a.sak_prov
and temp02.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp02.sak_prov_referring_2 = a.sak_prov
and temp02.cde_svc_loc_ref_2 = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp02.DTE_FINAL) >= :il_prev_18_months
OR NVL(MAX(temp02.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phrm_hdr temp03
WHERE ( (temp03.prov_billing = a.sak_prov and
temp03.cde_service_loc = a.cde_service_loc)
OR (temp03.sak_prov_rendering = a.sak_prov and
temp03.cde_svc_loc_rend = a.cde_service_loc)
OR (temp03.sak_presc_prov = a.sak_prov and
temp03.cde_svc_loc_presc = a.cde_service_loc)
OR temp03.id_prov_prescrb = to_char(a.sak_prov) || a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp03.DTE_FINAL) >= :il_prev_18_months
OR NVL(MAX(temp03.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phys_dtl temp04
WHERE ( (temp04.sak_prov_perf = a.sak_prov
and temp04.cde_svc_loc_rend = a.cde_service_loc)
OR (temp04.sak_prov_referring = a.sak_prov
and temp04.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp04.sak_prov_referring_2 = a.sak_prov
and temp04.cde_svc_loc_ref_2 = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp04.DTE_LAST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp04.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_phys_hdr temp05
WHERE ( (temp05.prov_billing = a.sak_prov
and temp05.cde_service_loc = a.cde_service_loc)
OR (temp05.sak_prov_perf = a.sak_prov
and temp05.cde_perf_svc_loc = a.cde_service_loc)
OR (temp05.sak_prov_referring = a.sak_prov
and temp05.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp05.sak_prov_referring_2 = a.sak_prov
and temp05.cde_svc_loc_ref_2 = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp05.DTE_FINAL) >= :il_prev_18_months
OR NVL(MAX(temp05.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_ub92_dtl temp06
WHERE ( (temp06.sak_pr_other = a.sak_prov
and temp06.cde_scv_loc_other = a.cde_service_loc)
OR (temp06.sak_pr_other_2 = a.sak_prov
and temp06.cde_svc_loc_other_2 = a.cde_service_loc)
OR (temp06.sak_pr_attend = a.sak_prov
and temp06.cde_svc_loc_attend = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp06.DTE_LAST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp06.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_deny_ub92_hdr temp07
WHERE ( (temp07.prov_billing = a.sak_prov
and temp07.cde_service_loc = a.cde_service_loc)
OR (temp07.sak_pr_facility = a.sak_prov
and temp07.cde_svc_loc_fa = a.cde_service_loc)
OR (temp07.sak_pr_other = a.sak_prov
and temp07.cde_svc_loc_other = a.cde_service_loc)
OR (temp07.sak_pr_other_2 = a.sak_prov
and temp07.cde_svc_loc_other_2 = a.cde_service_loc)
OR (temp07.sak_pr_attend = a.sak_prov
and temp07.cde_svc_loc_attend = a.cde_service_loc)
OR temp07.id_prov_attend = to_char(a.sak_prov) || a.cde_service_loc
OR temp07.id_prov_other = to_char(a.sak_prov) || a.cde_service_loc
OR temp07.id_prov_other_2 = to_char(a.sak_prov) || a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp07.DTE_FINAL) >= :il_prev_18_months
OR NVL(MAX(temp07.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_dntl_dtl temp08
WHERE temp08.sak_prov_perf = a.sak_prov
and temp08.cde_svc_loc_perf = a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp08.DTE_FIRST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp08.DTE_FIRST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_dntl_hdr temp09
WHERE ( (temp09.prov_billing = a.sak_prov
and temp09.cde_service_loc = a.cde_service_loc)
OR (temp09.sak_prov_perf = a.sak_prov
and temp09.cde_perf_svc_loc = a.cde_service_loc)
OR (temp09.sak_prov_referring = a.sak_prov
and temp09.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp09.sak_prov_referring_2 = a.sak_prov
and temp09.cde_svc_loc_ref_2 = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp09.DTE_FINAL) >= :il_prev_18_months
OR NVL(MAX(temp09.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_pharm_hdr temp10
WHERE ( (temp10.prov_billing = a.sak_prov
and temp10.cde_service_loc = a.cde_service_loc)
OR (temp10.sak_prov_rend = a.sak_prov
and temp10.cde_svc_loc_rend = a.cde_service_loc)
OR (temp10.sak_presc_prov = a.sak_prov
and temp10.cde_svc_loc_presc = a.cde_service_loc)
OR temp10.id_prov_prescrb = to_char(a.sak_prov) || a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp10.DTE_FINAL) >= :il_prev_18_months
OR NVL(MAX(temp10.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_phys_dtl temp11
WHERE ( (temp11.sak_prov_perf = a.sak_prov
and temp11.cde_svc_loc_rend = a.cde_service_loc)
OR (temp11.sak_prov_referring = a.sak_prov
and temp11.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp11.sak_prov_referring_2 = a.sak_prov
and temp11.cde_svc_loc_ref_2 = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp11.DTE_LAST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp11.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_phys_hdr temp12
WHERE ( (temp12.prov_billing = a.sak_prov
and temp12.cde_service_loc = a.cde_service_loc)
OR (temp12.sak_prov_perf = a.sak_prov
and temp12.cde_perf_svc_loc = a.cde_service_loc)
OR (temp12.sak_prov_referring = a.sak_prov
and temp12.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp12.sak_prov_referring_2 = a.sak_prov
and temp12.cde_svc_loc_ref_2 = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp12.DTE_FINAL) >= :il_prev_18_months
OR NVL(MAX(temp12.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_ub92_dtl temp13
WHERE ( (temp13.sak_pr_other = a.sak_prov
and temp13.cde_scv_loc_other = a.cde_service_loc)
OR (temp13.sak_pr_other_2 = a.sak_prov
and temp13.cde_svc_loc_other_2 = a.cde_service_loc)
OR (temp13.sak_pr_attend = a.sak_prov
and temp13.cde_svc_loc_attend = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp13.DTE_LAST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp13.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim01.t_pd_ub92_hdr temp14
WHERE ( (temp14.prov_billing = a.sak_prov
and temp14.cde_service_loc = a.cde_service_loc)
OR (temp14.sak_pr_facility = a.sak_prov
and temp14.cde_svc_loc_fa = a.cde_service_loc)
OR (temp14.sak_pr_other_2 = a.sak_prov
and temp14.cde_svc_loc_other_2 = a.cde_service_loc)
OR (temp14.sak_pr_attend = a.sak_prov
and temp14.cde_svc_loc_attend = a.cde_service_loc)
OR (temp14.sak_pr_other = a.sak_prov
and temp14.cde_svc_loc_other = a.cde_service_loc)
OR temp14.id_prov_attend = to_char(a.sak_prov) || a.cde_service_loc
OR temp14.id_prov_other = to_char(a.sak_prov) || a.cde_service_loc
OR temp14.id_prov_other_2 = to_char(a.sak_prov) || a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp14.DTE_FINAL) >= :il_prev_18_months
OR NVL(MAX(temp14.DTE_FINAL),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_dental_dtl temp15
WHERE temp15.sak_prov_perf = a.sak_prov
and temp15.cde_svc_loc_perf = a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp15.DTE_FIRST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp15.DTE_FIRST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_dental_hdr temp16
WHERE ( (temp16.sak_prov_perf = a.sak_prov
and temp16.cde_perf_svc_loc = a.cde_service_loc)
OR (temp16.sak_prov_referring = a.sak_prov
and temp16.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp16.sak_prov_referring_2 = a.sak_prov
and temp16.cde_svc_loc_ref_2 = a.cde_service_loc)
OR (temp16.prov_billing = a.sak_prov
and temp16.cde_service_loc = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING ((MAX(temp16.DTE_LAST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp16.DTE_LAST_SVC),0) = 0)
and (MAX(temp16.DTE_BILLED) >= :il_prev_18_months
OR NVL(MAX(temp16.DTE_BILLED),0) = 0) )
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phrm_hdr temp17
WHERE ( (temp17.prov_billing = a.sak_prov
and temp17.cde_service_loc = a.cde_service_loc)
OR (temp17.sak_prov_rend = a.sak_prov
and temp17.cde_svc_loc_rend = a.cde_service_loc)
OR (temp17.sak_presc_prov = a.sak_prov
and temp17.cde_svc_loc_presc = a.cde_service_loc)
OR temp17.id_prov_prescrb = to_char(a.sak_prov) || a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp17.DTE_BILLED) >= :il_prev_18_months
OR NVL(MAX(temp17.DTE_BILLED),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phys_dtl temp18
WHERE ( (temp18.sak_prov_perf = a.sak_prov
and temp18.cde_svc_loc_rend = a.cde_service_loc)
OR (temp18.sak_prov_referring = a.sak_prov
and temp18.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp18.sak_prov_referring_2 = a.sak_prov
and temp18.cde_svc_loc_ref_2 = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp18.DTE_LAST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp18.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_phys_hdr temp19
WHERE ( (temp19.prov_billing = a.sak_prov
and temp19.cde_service_loc = a.cde_service_loc)
OR (temp19.sak_prov_perf = a.sak_prov
and temp19.cde_perf_svc_loc = a.cde_service_loc)
OR (temp19.sak_prov_referring = a.sak_prov
and temp19.cde_svc_loc_ref_1 = a.cde_service_loc)
OR (temp19.sak_prov_referring_2 = a.sak_prov
and temp19.cde_svc_loc_ref_2 = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING ((MAX(temp19.DTE_LAST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp19.DTE_LAST_SVC),0) = 0)
and (MAX(temp19.DTE_BILLED) >= :il_prev_18_months
OR NVL(MAX(temp19.DTE_BILLED),0) = 0) )
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_ub92_dtl temp20
WHERE ( (temp20.sak_pr_other = a.sak_prov
and temp20.cde_scv_loc_other = a.cde_service_loc)
OR (temp20.sak_pr_other_2 = a.sak_prov
and temp20.cde_svc_loc_other_2 = a.cde_service_loc)
OR (temp20.sak_pr_attend = a.sak_prov
and temp20.cde_svc_loc_attend = a.cde_service_loc)
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp20.DTE_LAST_SVC) >= :il_prev_18_months
OR NVL(MAX(temp20.DTE_LAST_SVC),0) = 0
union
select a.sak_prov, a.cde_service_loc, a.sak_short from pr_php_elig_tmp a, aim00.t_susp_ub92_hdr temp22
WHERE ( (temp22.prov_billing = a.sak_prov
and temp22.cde_service_loc = a.cde_service_loc)
OR (temp22.sak_pr_facility = a.sak_prov
and temp22.cde_svc_loc_fa = a.cde_service_loc)
OR (temp22.sak_pr_other_2 = a.sak_prov
and temp22.cde_svc_loc_other_2 = a.cde_service_loc)
OR (temp22.sak_pr_attend = a.sak_prov
and temp22.cde_svc_loc_attend = a.cde_service_loc)
OR (temp22.sak_pr_other = a.sak_prov
and temp22.cde_svc_loc_other = a.cde_service_loc)
OR temp22.id_prov_attend = to_char(a.sak_prov) || a.cde_service_loc
OR temp22.id_prov_other = to_char(a.sak_prov) || a.cde_service_loc
OR temp22.id_prov_other_2 = to_char(a.sak_prov) || a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX(temp22.DTE_BILLED) >= :il_prev_18_months
OR NVL(MAX(temp22.DTE_BILLED),0) = 0
);Perhaps an approach like this would work better. No promises, but it's worth a try.
SELECT *
FROM pr_php_elig_tmp a
WHERE NOT EXISTS (
SELECT a.sak_prov,
a.cde_service_loc,
a.sak_short
FROM aim01.t_deny_dntl_dtl temp01
WHERE temp01.sak_prov_perf = a.sak_prov
AND temp01.cde_svc_loc_perf = a.cde_service_loc
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX (temp01.dte_first_svc) >= :il_prev_18_months
OR NVL (MAX (temp01.dte_first_svc), 0) = 0)
AND NOT EXISTS (
SELECT a.sak_prov,
a.cde_service_loc,
a.sak_short
FROM aim01.t_deny_dntl_hdr temp02
WHERE ( ( temp02.prov_billing = a.sak_prov
AND temp02.cde_service_loc = a.cde_service_loc)
OR ( temp02.sak_prov_perf = a.sak_prov
AND temp02.cde_perf_svc_loc = a.cde_service_loc)
OR ( temp02.sak_prov_referring = a.sak_prov
AND temp02.cde_svc_loc_ref_1 = a.cde_service_loc)
OR ( temp02.sak_prov_referring_2 = a.sak_prov
AND temp02.cde_svc_loc_ref_2 = a.cde_service_loc))
GROUP BY a.sak_prov, a.cde_service_loc, a.sak_short
HAVING MAX (temp02.dte_final) >= :il_prev_18_months
OR NVL (MAX (temp02.dte_final), 0) = 0) -
SQL Query - SCOM2012R2 Performance Counter
Need some assistance with a SQL query against my SCOM DW. I want this to do a select within a select. The inner select must collect the raw data for a performance counter, for the last 5 minutes. But SCOM will only give me counters that collected in the
last 5 minutes. What i want is the last value for every managed instance. - 1500 servers.
The outer SELECT must then filter this by doing a count on how many servers it collected a value for that are above 80% - and then divide that number by the total managed servers to give me a percentage of servers above 80% memory used. Eg - it counts 10
servers are above 80%, but theres 100 servers - then gives me a final figure of 90%.
select (count(abc.DaValue)) from (
select
vManagedEntity.Path
,vPerformanceRule.ObjectName
,vPerformanceRule.CounterName
,AVG(vPerfRaw.SampleValue) AS DaValue
from vPerfRaw
join vPerformanceRuleInstance on vPerformanceRuleInstance.PerformanceRuleInstanceRowid = vPerfRaw.PerformanceRuleInstanceRowid
join vPerformanceRule on vPerformanceRule.RuleRowId = vPerformanceRuleInstance.RuleRowId
join vManagedEntity on vManagedEntity.ManagedEntityRowid = vPerfRaw.ManagedEntityRowId
where vPerfRaw.Datetime > DATEADD(minute, -20, GETUTCDATE())
and vPerformanceRule.ObjectName = 'Memory'
and vPerformanceRule.CounterName = 'PercentMemoryUsed'
GROUP BY Path, ObjectName, CounterName, Name
Order by DaValue DESC)
as abc
where abc.DaValue >= 80
This statement gives me the result
Msg 1033, Level 15, State 1, Line 15
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
Any ideas ?Latest update -
SELECT count(DISTINCT abc.server) as NoOfServers,
count(case when abc.DaValue >= 90 then abc.DaValue end) 'MemoryAbove90%'
FROM( select TOP 100 PERCENT
vManagedEntity.Path as Server ,vPerformanceRule.ObjectName
,vPerformanceRule.CounterName ,AVG(vPerfRaw.SampleValue) AS DaValue
from Perf.vPerfRaw join vPerformanceRuleInstance on vPerformanceRuleInstance.PerformanceRuleInstanceRowid = vPerfRaw.PerformanceRuleInstanceRowid
join vPerformanceRule on vPerformanceRule.RuleRowId = vPerformanceRuleInstance.RuleRowId
join vManagedEntity on vManagedEntity.ManagedEntityRowid = vPerfRaw.ManagedEntityRowId
where vPerfRaw.Datetime > DATEADD(minute, -10, GETUTCDATE())
and vPerformanceRule.ObjectName = 'Memory' and vPerformanceRule.CounterName = 'PercentMemoryUsed'
GROUP BY Path, ObjectName, CounterName, Name
Order by DaValue DESC) as abc
This gives me Total Servers collected from, and Total Servers found to have AVG collections over 90% for Memory Util.
My KPI states that I must only display the number of servers that are above 90%, for more than 10minutes.
The problem with this is that when i run it over a 10 minute period, I get collections for about 40% of my managed servers only.
I want to know if anyone has a better way of collecting the perf data over a 10 minute period ?
What i was thinking of doing is running this query with time interval on 11 minutes, populating a temp table with the data, running the query
again with time interval on 1 minute ago, and comparing the results. IF it finds a match, I know that the server has been over 90% memory util for 10 minutes - then i can count it ? Its probably not entirely accurate, but Im out of ideas. From here, i want
to export the Values for Total Servers and TotalServersAbove90% into Excel, and build a guage off it that will reflect a % of Servers within SLA -Memory Util.
Im not entirely familiar with SCOM collection intervals, IF I run the query for the last 1 minute - It seems to skip alot of servers and only returns
data from about 50, is that because its not cycling on those at that moment ? In which case my idea above wont work.
UPDATE 2 - i think this will do it
Our OPS guy just told me that we sample every 10min. So immediately im thinking, perhaps i can run the query for the last 11 minutes - IF more than
1 sample is above 90%, the server is above 90% for more than 10min.
But, when i run this query
select TOP 100 Percent Path, AVG(SampleValue) AS Value, DateTime from Perf.vPerfRaw pvpr inner join vManagedEntity vme on pvpr.ManagedEntityRowId
= vme.ManagedEntityRowId inner join vPerformanceRuleInstance vpri on pvpr.PerformanceRuleInstanceRowId = vpri.PerformanceRuleInstanceRowId inner join vPerformanceRule vpr on vpr.RuleRowId = vpri.RuleRowId WHERE ObjectName = 'Memory' AND CounterName
= 'PercentMemoryUSed' AND Datetime > DATEADD(minute, -1, GETUTCDATE()) AND SampleValue >= 90 GROUP BY Path, SampleValue, DateTime ORDER BY DateTime DESC
I get a few servers, but some have more than 1 entry in the last 1 minute. Which means that i cant compare 2 samples.
Perhaps i could say if ALL samples collected per server in that 11 minute period are > 90,
then add 1 to MemoryAbove90% -
Query : Hyperion Performance Scorecard Rollup Functionality
Hi All,
Hyperion Performance Scorecard Rollup Functionality in measure and scorecard template.
Query: We are implementing Hyperion performance scorecard for a client using measure template and scorecard templates after build client came up with following new requirements-
Strategy hierarchy as follows-
Level 1- SBU (Parent) Level 2- Groups (Child), 3- Teams( Chilld), 4- Desk ( Child), 5- RM (Child)
1 Along with Existing scorecards functionality they need to roll up 2 KPIs (Credit Quality1,Credit Quality2) explicitly only at RM level ( at lowest level).
2- Need to follow this hierarchy for these scorecards roll up (RMs to Desks to Teams to Groups to SBUs)
3- No of KPIs to be used/modified (credit quality2 means bad assets-non performing loan & Credit quality 1 means good assets-performing loan)
4- Both these KPIs should roll up to all RMs only but KPI bad asset (Credit Quality2) should not roll up to Desk, to Teams, to Groups, To SBUs but KPI1 Good Assets (performing asset) should roll up to all levels.
4.1-Example let’s assume there are 2 RMs (RM1 & RM2) RM1 is having bad asset & RM2 is not having bad asset then only for RM1 both KPI should roll up but at above levels 1st KPI (non-performing assets ) should not roll up but second KPI ( performing assets) should roll up.
5- No of scorecards required means RMs * approx 3000, Desk*Total numbers ,Teams*Total numbers ,Groups*total numbers, finally SBUs*total numbers.
As per my understanding in the existing HPS design we are using Measure Templates & Scorecard Templates in which all KPIs are automatically rolling up to RMs then from RMs to all above hierarchies, now for this new requirement explicitly we need to create another scorecard (secondary scorecard) with 2 KPIs both should roll up to RMs (3000 approx) but should not roll up to above hierarchy (to Desks to Teams to Groups to SBUs) only we need to roll up 1 KPI to all above hierarchies not the other KPI or this new scorecard.
As per my understanding in the current design all KPIs are rolling up to all levels.
Question : In current scenario is there a possibility or solution to restrict a particular KPI to rollup to above levels?*
Any help would be highly appreciated.Thanks for your response!
I'm not sure that the Power Pivot plugin for Excel will be available here. We use Excel 2010. We have restrictions in our environment. Additionally, we have 32bit Office installed and my understanding is that you need 64 bit on both client and
server when working with Power Pivot. So exporting Excel Power Pivots from SharePoint 2010 to a 32 bit client wouldn't work (or vice-vera) wouldn't work.
By robust I mean the ability to utilize different types of data sources (CSV, EXCEL, SQL Server, ORACLE) as well as Data Models, (transactional, analytical, tabular). The ability to handle large datasets, pivot table funcitonality, drill down and drill
through, rich data visualizations.
Currently this data is in Oracle. I will need to export it to SQL and I would like to leave it as OLTP since OLAP technologies are not currently in our skill set. Hopefully these can be added in the next year or so. If Power View loses the bulk
of it's reporting power when moving to OLTP, I will just build these in SSRS UNLESS, I can use Group By, Rollup and CUBE in my queries to give Power View a data set where it's capabiliities can be utilized.
Love them all...regardless. - Buddha -
Where is the Query overall performance is checked??
Hello BW Experts,
Where is the Overall Query Performance can be checked??
Is it:
1.RSMO
2.RSBBM
3.SU01
4.Table RSDDSTAT(something like this, if its not correct)
Plz throw some light on this also <u>plz explain what and all could actually be checked or verified</u> in that!!
Thanks and regrads,
Sapster.
<i>I always assign points.</i>Hi,
RSRT is the one transaction to check query performance (pls correct if iam wrong!)
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3f66ba90-0201-0010-ac8d-b61d8fd9abe9
here is the docu abt the query performance.
hope this helps.
thanks & regards,
LS. -
Hi
I'm running into very big performance problems with QueryBuilder.
I'm using asset viewer to browse my CQ DAM images. We have loaded more than 100.000 images... all of them are tagged.
Launching an http request like the following one:
http://localhost:port/bin/querybuilder.json
?_charset_=utf-8
&_dc=1332289410422
&fulltext=
&1_group.property.3_value=tag1
&1_group.property.29_value=tag2
&1_group.property.30_value=tag3
&1_group.property.31_value=tag4
&1_group.property.32_value=tag5
&1_group.property.33_value=tag6
&1_group.property.34_value=tag7
&0_group.property=jcr%3Acontent%2Fmetadata%2Fcq%3Atags
&0_group.p.or=true
&1_group.property=jcr%3Acontent%2Fmetadata%2Fcq%3Atags
&1_group.p.or=true
&p.limit=24
&2_group.0_path=%2Fcontent%2Fdam%2Fmyfolder%2Fimage%2Fprodotto
&3_group.0_type=dam%3AAsset
&mainasset=true
&p.hitwriter=full
&p.nodedepth=4
&orderby=path
&p.offset=0
it is going to take a *lot* of time (22 minutes!). This query has 36.000 results... but they are paginated... It's not possible to wait 22 minutes to get the first page of results... so I think I'm making some mistakes in the query, but cannot find anything to make it better following the documentation.
How can I improve performances?
Thanks
IgnazioHi Alex.
Yes, the order by may be consuming and I already removed it in the past. I have removed it again, but it is not the dominant.
It's difficult for me to explain to a client that with asset viewer (using querybuilder) he has to wait for a very long time to get the first 24 results of a set of 20.000 matches in a 120.000 image repository.
I can understand I need to wait a lot of time to get all the 20.000 matches, but I'm asking only for the first 24 (the first page) setting p.limit = 24.
Here the debug for the query I'm referring to:
21.03.2012 13:18:41.613 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl executing query (URL):
0_group.p.or=true&0_group.property=jcr%3acontent%2fmetadata%2fcq%3atags&0_group.property.0 _value=immaginegenerale&1_group.p.or=true&1_group.property=jcr%3acontent%2fmetadata%2fcq%3 atags&2_group.0_path=%2fcontent%2fdam%2fimage%2fprodotto&3_group.0_type=dam%3aAsset&fullte xt=&fulltext.relPath=jcr%3acontent%2fmetadata%2f%40dc%3amarketingdescription&mainasset=tru e&p.hitwriter=full&p.limit=24&p.nodedepth=4&p.offset=0
21.03.2012 13:18:41.613 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl executing query (predicate tree):
ROOT=group: limit=24, hitwriter=full, nodedepth=4, offset=0[
{fulltext=fulltext: relPath=jcr:content/metadata/@dc:marketingdescription, fulltext=}
{mainasset=mainasset: mainasset=true}
{0_group=group: or=true[
{property=property: property=jcr:content/metadata/cq:tags, 0_value:immaginegenerale}
{1_group=group: or=true[
{property=property: property=jcr:content/metadata/cq:tags}
{2_group=group: [
{0_path=path: path=/content/dam/image/prodotto}
{3_group=group: [
{0_type=type: type=dam:Asset}
21.03.2012 13:18:41.615 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl xpath query: /jcr:root/content/dam/image/prodotto//element(*, dam:Asset)[((jcr:content/metadata/@cq:tags = 'immaginegenerale'))]
21.03.2012 13:18:44.078 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl xpath query took 2465 ms
21.03.2012 13:18:44.078 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl filtering predicates: {mainasset=mainasset: mainasset=true}, , , ,
21.03.2012 13:22:16.394 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl >> xpath query returned 20117 results (counted)
21.03.2012 13:22:16.395 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl filtering took 212317 ms
21.03.2012 13:22:16.395 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl >> after filtering there are 20117 results
21.03.2012 13:22:16.397 *INFO* [172.31.2.2 [1332332321612] GET /bin/querybuilder.json HTTP/1.1] com.day.cq.search.impl.builder.QueryImpl entire query execution took 214784 ms
As you can see all the time is spent on the filtering predicates.
Is there a way to cut down significantly this time? or is it possible to distribute this effort only during pagination?
in a db-like approach I would have done a sql SELECT COUNT followed by a SELECT LIMIT 0,24... for sure taking a portion of this time.
Thanks
Ignazio
Maybe you are looking for
-
Add new fields in SAP transaction IW22
Hello, I want to add 2 new fields in SAP standard transaction IW22. I checked the package for this transaction and it is IWOC. I searched the exits for package IWOC but was not able to find any screen exits for it. Kindly help me on how I should proc
-
Forest trust unable to find Active Directory Domain Controller
I have two domains with a two-way forest trust. We'll call them ForestA and ForestB. They're on seperate subnets. ForestA's DCs are in one physical location. ForestB's DCs are in two locations, one of which is shared with A. I'm unable to route traff
-
How do you fix green blotches on teeth in iMovie?
After using a green screen there are green blotches on her teeth and I can't figure out how to fix it in iMovie 10.0.7. Help.
-
after i install any version of firefox on my htc chacha (android 2.3),when i open firefox,in some versions of firefox i get this error: "the application firefox (process org.mozilla.firefox) has stopped unexpectedly.please try again." and when i try
-
Weird problem about FM 'CRM_ORDER_MAINTAIN'
Hello ,all: I try to modify some infomation about a sales order using FM 'CRM_ORDER_MAINTAIN'.But how strange,for instance,it can be successful for the first time in the morning (a.m)and the FM executes a long time ,then modified infomation is