Re-write query to perform
I have a query which I have simplified below. The parts in bold retrieve the same resultset but are too expensive for me to execute twice. Is there a way to re-write this query so that the part in bold is only executed once?
I have tried using subquery factoring but that causes my <some_predicate> clause to be used at a later stage in the query which proves disastrous.
select * from (
select 'a' as cola, 1 as colb from dual
union all
select 'Total', sum(colb)
from (select 'a' as cola, 1 as colb from dual union all
select 'b' as cola, 2 as colb from dual)
) where <some_predicate>
How would you apply it to my example and get the same
output?
select decode(grouping_id(cola,colb,rownum),0, cola, 'TOTAL:') as cola,
sum(colb) as colb
from (
select 'a' as cola, 1 as colb from dual union all
select 'b' as cola, 2 as colb from dual
group by grouping sets((),(cola,colb,rownum))
having <some_predicate>
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. -
What to write query to get know if a checkbox is checked
hello,
I have created a checkbox with name Entertainment containing static values Movie,Play,music.
Now i have to write query to check which value of checkbox is checked ,means play or movie or music.
According to that i have to mail a particular link to a user.
I have seen in how to (checkbox help) but not getting it.
please anyone can help me out.HI marc,
I think so u are not able to get my problem,i will explain it in detail.
I have a table USERINFO which has variables of type varchar2,these variable are used as a checkbox on page name 'ENTER INFORMATION',these checkbox have some static values,every time a user checks checkbox values it get stored in database,suppose there is a checkbox name sport with static values cricket,football,now if any user select cricket this value get stored in database with username ,mailid.
Now i have a page on this i want to give user facility to enter name of checkbox to create and its corresponding static values,and these checkbox should get display on page 'ENTER INFORMATION'and a variable of type varchar2() with checkbox name should get create in tableUSERINFO .
now can u suggest me how can i achieve this. -
Regarding using text editor in 11g for writting query
how can i use text editor in oracle 11g for writting query as in oracle 9i in which we use 'ed' command.
user13063489 wrote:
how can i use text editor in oracle 11g for writting query as in oracle 9i in which we use 'ed' command.This is really for asking in the database forum.
However I assume you are using sqlplus
If this is the case define the _EDITOR variable to one of the following as appropriate ....
DEFINE _EDITOR=notepad
DEFINE _EDITOR=vi
For more assistance use the database general forum. -
Can we write query for fomatted search without from clause
can we write query for fomatted search without from clause as below.
SELECT (($(u_amt)*14)/100)
here U_amt is a UDF .I want to assign this to another field .
Rgds,
RajeevHi Rajeev,
You can write query for FMS without from. That is because you can omit it when you get value from active form by default. The grammar of it is:
Select $[$38.u_amt.0\] * 14/100 in your case if you have item type marketing document @line level.
From View-System Information, you can get the info you need for your FMS query at the left bottom of your screen.
Thanks,
Gordon -
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 write query group by time(minutes)
Hi,
i am writting query like this.
select host_id,pd_user, pdUserUtil,
timestamp from
(select host_id,pd_user,
avg(pd_cpu) pdUserUtil,
to_Char(PD_REPORTED_TIMESTAMP,'yyyy-mm-dd hh:MI') timestamp
from sp_process_detail_current SP
where exists (select * from
sp_process_detail_current
having
max(PD_REPORTED_TIMESTAMP)-sp.PD_REPORTED_TIMESTAMP<5/1440)
group by pd_user,host_Id,to_Char(PD_REPORTED_TIMESTAMP,'yyyy-mm-dd hh:MI'))
where host_id='DSCP04881' and pd_user='TOMCAT'
TIMESTAMP PD_USER
2006-06-30 08:07 TOMCAT
2006-06-30 08:08 TOMCAT
2006-06-30 08:10 TOMCAT
BUT WHILE ACCESSING IN JAVA
java.lang.NumberFormatException: For input string: "30:08:07"
at java.lang.NumberFormatException.forInputString(NumberFormatException.Question: What datatype in Java are you using as placeholder for the timestamp column?
It's only taking the "2006-06-" part.
Post here the java code (an exceprt of course), though I feel there's better forums for this subject. -
Hi,
I need expert advice.
on daily basis we are updating meter reading ( meter reading is nothing but "meter number / unit / date".
Let say there are 10 apartment and each apartment has separate meter.
i need to write query get missing meter reading on a specific date.
ThanksUnit Master
401
402
403
404
Daily Meter Reading
date unit meter
01-01-01 1 401
01-01-01 1 402
01-01-01 1 404 ( on 1st of jan user update the meter reading but if you notice unit number 403 is missing)
02-01-01 1 401
02-01-01 402 ( on 2nd of jan user update the meter reading but if you notice this time 402 is meter unit is missing)
02-01-01 1 403
02-01-01 1 404
03-01-01 401
03-01-01 1 402
03-01-01 1 403 ( on 3rd of jan user update the meter reading but if you notice this time meter unit is missing for 401 and 404 is unit is missing)
We want the following output
if user run report on 1st of jan system should return value of 403 unit number
if user run report on 2nd of jan then system should return value of 402 unit number
if user run report on 3rd of jan then system should return value of 401/404 unit number
Hope this help to get my expected answer. -
How to write query for this in TopLink ?
I am doing a simple search in jsp where the search will the based on the choices chosen by user.
I had given 3 check boxes for those choices.
The problem is, query will be based on the choice or choices chosed by the user.
How to write query for this in TopLink ?
Thanks in Advance..
JayaganeshTry below solution, it is NOT best solution but might work:
Declare @Questions TABLE (QuestionID INT, QuestionText Varchar(100))
INSERT INTO @Questions
VALUES (1, 'Comment'), (2, 'Score')
DECLARE @Answers TABLE (authkey INT, QuestionID INT, questiontext VARCHAR(100), answertext VARCHAR(100))
INSERT INTO @Answers
VALUES (101, 1, 'comment', 'hi!!'), (101, 2, 'score', '4'), (102, 1, 'comment', 'excellent'), (102, 2, 'score', '5'), (103, 2, 'score', '6'), (104, 2, 'score', '8')
SELECT
A.AuthKey
,Q.QuestionID
,Q.QuestionText
,A.AnswerText
FROM
@Questions Q
INNER JOIN @Answers A ON Q.QuestionID = A.QuestionID
UNION
SELECT
A.AuthKey
,Q.QuestionID
,Q.QuestionText
,Null
FROM
@Questions Q
CROSS JOIN @Answers A
WHERE
NOT EXISTS (SELECT 1 FROM @Answers SubQry WHERE SubQry.AuthKey = A.AuthKey AND SubQry.QuestionID = Q.QuestionID)
Output
AuthKey | QuestionID
| QuestionText
| AnswerText
101 | 1 | Comment | hi!!
101 | 2 | Score | 4
102 | 1 | Comment | excellent
102 | 2 | Score | 5
103 | 1 | Comment | NULL
103 | 2 | Score | 6
104 | 1 | Comment | NULL
104 | 2 | Score | 8
Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered. -
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] -
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 -
Hello, I have an extremely complicated query, that has a structure similar to:
Overall Query
---SubQueryA
-------SubQueryB
---SubQueryB
---SubQueryC
-------SubQueryA
The subqueries themselves are slow, and having to run them multiple times is much too slow! Ideally, I would be able to run each subquery once, and then use the results. I cannot use standard oracle tables, and i would need to keep the result of the subqueries in memory.
I was thinking I write a pl/sql script that did the subqueries at the beginning and stored the results in memory. Then in the overall query, I could loop through my results in memory, and join the results of the various subqueries to one another.
some questions:
-what is the best data structure to use? I've been looking around and there are nested arrays, and there's the bulk insert functionality, but I'm not sure what is the best to you
-the advantage of the method I'm suggesting is that I only have to do each subquery once. But, when I start joining the results of the subquery to one another, will I take a performance hit? will Oracle not be able to optimize the joins?
thanks in advance!
CoopI cannot use standard oracle tablesWhat does this mean? If you have subqueries, i assume you have tables to drive them? You're in an Oracle forum, so i assume the tables are Oracle tables.
If so, you can look into the WITH clause, it can 'cache' the query results for you and reuse them multiple times, also helpful in making large queries with many subqueries more readable. -
Hi,
I have written a query in 9i and now i am learning 10G using rgexp. Please can anyone give me a hint how to re-write this query in 10G. Query and output is given below:
select a,SUBSTR(ADDRESS_FORM,INSTR(a,' ')+1) b
FROM TEMP
Input
A
79 RACECOURSE ROAD
65 REDCLIFFE PARADE
65 GOLF LINKS RD
B
RACECOURSE ROAD
REDCLIFFE PARADE
GOLF LINKS RD
Best Regards,I have written a query in 9i and now i am learning 10G using rgexp.At the risk of being blunt, are you actually learning anything about regular expressions? Because you keep posting question after question on the same topic:
I know how to do it in Oracle 9i but i am trying to learn using regexp.
I have to do this using regexp thats why i have asked.
I have following data and want to write a query using regexp to extract
I have to use Oracle 10g and regexp
i have to use regexp as i am using 10g
I want to use regexp expression to extract data between two spaces
I have to use regexp as now i am in 10g i know how to perform this task in 9i.
How can i select the last character from string using regex :Maybe it's time you read this book:
http://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1208914879&sr=1-1 -
Hi,
Millions of records are there in this order table and it takes hours to run the below query
update orders
set s_last_name = decode(s_last_name, null, null, (select last_name from cust where cust_id = orders.cust_id)),
credit_card = null;
Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
UPDATE STATEMENT | | 35M| 1388M| 319K (3)| 01:03:55 |
UPDATE | ORDERS | | | | |
PARTITION RANGE ALL | | 35M| 1388M| 319K (3)| 01:03:55 |
TABLE ACCESS FULL | ORDERS | 35M| 1388M| 319K (3)| 01:03:55 |
TABLE ACCESS BY GLOBAL INDEX ROWID | CUST | 1 | 14 | 3 (0) | 00:00:01 |
INDEX RANGE SCAN | CUST_PK| 1 | | 2 (0) | 00:00:01 |
is it possible to write in a different way to improve the performance.. thanks. BcjYou're running an update with an uncorrelated subquery. These can be horrifically slow. You generally have 2 options:
1. Correlated subquery
2. Do the update inside a loop. #1 if possible will probably be faster
1. Correlated subquery looks something like
update table A
setl (column1, column2) = (select column1, column2
from table2
where table2.key = A.key
)which might be faster, if the lookup table is properly indexed on the correlated column
2. Update in loop looks something like
for record in (key, select column1, column2 from table)loop
update table2
set column1 = record.column1, column2 = record.column2
where table2.key = record.key
end loop;which may be faster than the original update (or may not). This method has the advantage of allowing periodic commits; people who say you should never do periodic commits have never blown out rollback segments. If you must use the loop method commit at least 4k rows (more rows per commit is better).
Maybe you are looking for
-
When I go to download from my iTunes account, it has started to say that I have to verify my ID. When only last week I was able to download ok. The questions it asks me are not relevant to me and I need to know how to reset the questions. For exa
-
Count the number of values in a two dimensional array
i am trying to figure out how to count the number of values in a two dimensional array. numScores = student[i][j].length;This doesn't work, i am trying to find a way of counting the columns
-
*when we use at user -command and give smaple code fro at user-command*
Hi experts, i am new to abap can any body tell me when we use AT USER-COMMAND and give a sample code for that. point will be rewarded. thanks.
-
Migration of emulated datasource from 3.5 to BI 7
Hi Experts, For a requirement I want to migrate a emulated datasource 0material_attr to bi 7.Previously some one already developed complete dataflow in 3.x, now i need to migrate every thing in bi 7.In order to make sure do i need to follow any
-
Hi I am trying to change my 64 bit to 32 bit. I have tried going to the application get info to changed it but it does not give me this option. Is there another way to change to 32 bit. thanks