Query performance to be increased..please help..
hi,
SELECT TSK.TaskID AS [SprintID]
,TSK.Title AS [Sprint]
,TSK.[StartDate]
,TSK.[EndDate]
,SRA.[ResourceID]
,R.[ResourceName]
,D.[UID] AS [DivisionID]
,D.[Division]
,T.[UID] AS [TechnologyID]
,T.Technology
,'Free On '+ CONVERT(NVARCHAR,TSK.[EndDate],103) [FreeStatus]
,ISNULL(RSS.[Rating],0) [Rating]
FROM tb_Technology T
,Tasks TSK INNER JOIN TasksResource SRA ON TSK.TaskID = SRA.TaskID
INNER JOIN tb_Resource R ON R.[UID] = SRA.[ResourceID] AND R.IsActive = 1
LEFT JOIN tb_ResourceSkillset RSS ON RSS.[ResourceID] = R.[UID] AND RSS.IsActive =1
LEFT JOIN tb_Division D ON D.[UID] = R.[DivisionID]
WHERE TSK.EndDate >= @StartDate AND TSK.EndDate <= @EndDate AND D.IsActive = 1 AND T.IsActive = 1
AND D.[UID] = (CASE WHEN @DivisionID > 0 THEN @DivisionID ELSE D.[UID] END)
AND T.[UID] = (CASE WHEN @TechnologyID > 0 THEN @TechnologyID ELSE T.[UID] END)
UNION
SELECT 0 AS [SprintID]
,'' AS [Sprint]
,CAST(GETDATE() AS DATE) AS [StartDate]
,CAST(GETDATE() AS DATE) AS [EndDate]
,R.[UID] AS [ResourceID]
,R.[ResourceName]
,D.[UID] AS [DivisionID]
,D.[Division]
,T.[UID] AS [TechnologyID]
,T.Technology
,'Free' [FreeStatus]
,ISNULL(RSS.[Rating],0) [Rating]
FROM tb_Technology T,
tb_Resource R
LEFT JOIN tb_ResourceSkillset RSS ON RSS.[ResourceID] = R.[UID] AND RSS.IsActive = 1
LEFT JOIN tb_Division D ON D.[UID] = R.[DivisionID]
WHERE R.[UID] NOT IN (SELECT SRA.ResourceID FROM TasksResource SRA)
AND R.IsActive = 1 AND T.IsActive = 1
AND D.[UID] = (CASE WHEN @DivisionID > 0 THEN @DivisionID ELSE D.[UID] END)
AND T.[UID] = (CASE WHEN @TechnologyID > 0 THEN @TechnologyID ELSE T.[UID] END)
i'm using the above code..where my technology table has 18,900 rows and task has 109 rows.
when these 2 are cross joined i think more time taking...this query is taking much time to execute.pls help me how can i retrieve the result with less time.
total result is 3lakhs rows and running more than 7-8min..
lucky
Hallo Lucky,
additional to the points of Erland and Uri some questions:
How do you pass the variables to the query?
DECLARE @StartDate date;
DECLARE @EndDate date;
DECLARE @DivisionId int;
SET @StartDate = '20130101';
SET @EndDate = '20130131';
SET @DivisionId = 1;
SELECT ....
ALL stuff from your query;
or is it part of a procedure where these parameters are coming from the proc itself?
The reason is a quite simple one.
If you run the query inside SSMS with my given example the query optimizer doesn't know the values in the moment of compilation and estimates only 1 record.
Please share the execution plan with us to help you.
Use your query with the following statement before it:
SET STATISTICS PROFILE ON;
GO
SELECT
ALL FROM your query
Can you post the result (in a readable Format please!) here?
MCM - SQL Server 2008
MCSE - SQL Server 2012
db Berater GmbH
SQL Server Blog (german only)
Similar Messages
-
Grouping Inner Query based on a column.Please help
I have a strange query.
I am using Subquery to display the count of rows from the inner query
depending upon the value of 'Y' or 'N'
Trade
id_entity id_inst_code_type id_inst_code dt_trade
AGL SE 5660249 10-Feb-06
AGL SE 5660249 13-Feb-06
AGL SE 5660249 13-Feb'06
Instrument_xref
ID_inst id_inst_xref_type id_inst_xref flg_active
0029010 SE 5660249 Y
0070789 SE 5660249 Y
0071190 SE 5660249 Y
0072385 SE 5660249 Y
0073215 SE 5660249 Y
0084797 SE 5660249 Y
0091375 SE 5660249 Y
0094690 SE 5660249 Y
0104438 SE 5660249 Y
My output:
id_inst_code_type id_inst_code Earliest Latest Total Active
SE 5660249 10 Feb 06 13 Feb 06 3 9
2) If all the 'flg_active' column in Table Instrument_xref is set to 'N'
the Active should be 0.
3) Assume that the flg_active could be 3 Y's and 6 N's then what?
id_inst_code_type id_inst_code Earliest Latest Total Active
SE 5660249 10 Feb 06 13 Feb 06 3 0
How do I check for the 'Y' or 'N' value in my code below ?
Help appreciated as the the functionality changes by the hour...
select tie.id_entity 'Entity',
tie.id_inst_code 'Inst Code',
min(tie.dt_trade) 'Earliest',
max(tie.dt_trade) 'Latest',
count(*) 'Total',
dt.InnerTotal 'Active'
from trade_input_event tie,
(Select insx.id_inst_xref_type,
insx.id_inst_xref,
insx.flg_active,
count(*) InnerTotal
from instrument_xref insx
where insx.id_inst_xref = '5660249'
---** Do I need to Check the flg_active here..
---** Do I need to use the Having clause here? ie having count(insx.id_inst_xref) = 'N'
group by insx.id_inst_xref_type,insx.id_inst_xref,insx.flg_active) dt
where tie.id_inst_code = dt.id_inst_xref
and tie.id_entity = 'AGL'
group by tie.id_entity, tie.id_inst_code_type,tie.id_inst_codeAs the flg_active is set to 'Y', I am trying to set it to 'N' in the query
so that count of 0 is returned, but this displays nothing.
Please help as to how to display a count(*) of 0 when the flg_active is 'N'??
Select insx.id_inst_xref_type,
insx.id_inst_xref,
insx.flg_active,
count(*) InnerTotal
from instrument_xref insx
where insx.id_inst_xref = '5660249'
and insx.flg_active = 'N'
group by insx.id_inst_xref_type,insx.id_inst_xref,insx.flg_active) dt -
Archive logs are increasing please help
Hi,
i have a serious problem, iasdb- that portal is installed on- version 10.3.0.1
and its continuosly writing logs, every 15-16 seconds and eats disk space . any one have the similar experience - continuosly written archive logs, please help me. i coulndt understand what caused this.
thanks in advanceYou could disable archivelog mode in the DB if you dont need to perform a point-in-time recovery.
-
Sql query for quarter data..Please help
Dear Experts,
Please help with this query...
i have data like below:
Year
Quarter
MRR
MRR%
2012
Q1
10
Q2
30
Q3
50
Q4
60
2013
Q1
20
Q2
30
Now i need to caluclate MRR % column values as below
for 2012 Q2 MRR % = (Q2MRR-Q1MRR)/Q1*100 that is (30-10)/10*100
for 2012 Q3 MRR % = (Q4MRR-Q3MRR)/Q2*100
for 2012 Q4 MRR %= (Q1MRR-Q4MRR)/Q1*100 here q1 of 2013 and q4 of 2012...
like this it wll go on..
Please help with me query compute values in MRR % column.
Best regards
aspMaybe NOT TESTED! No Database at hand
select year,quarter,mrr,
ratio_to_report(q_mrr) over (partition by year order by quarter) pct_mrr
from (select year,quarter,mrr,
mrr - lag(mrr,1,0) over (partition by year order by quarter) q_mrr
from t
Regards
Etbin -
A query on Flexfield and valuesets.Please help me in sorting out
We have created a structure in descriptive flexfield with 4 to 5 segments. Among those one segment has a value set with independent validation type. And all the other segments have value set with dependent validation type on the first segment.
Now the requirement as per client is as follows:
If first segment is taken as YES, all the other segments are to be displayed and enabled. If it is NO, then all the segments have to disabled.
We are able to get it in case of YES but if it is NO, all the segments are being displayed.But we even want them to disable or display off.
Please help me out in sorting out this issue.Hi,
I don't think thats possible, when you have a valueset in which you are referencing a previous parameter using the $FLEX.<Parameter_name> property, apps automatically sets the dependency. The dependent item is automatically enabled as soon as you enter a value in the dependable field. There is no way to set this dependency conditionally.
What you can do instead is change the query of your valuesets so that it does not have any records
i.e $FLEX.<Parameter> = 'YES'
Regards,
Vikash
oraclehrmsways.blogspot.com
Message was edited by:
vsethi -
Quey Performance Issue !! Please help.
Hi All
I am new to query tuning, so please ignore if I ask some bad questions !
I have a huge table M with 4,48,42,682 records in Oracle 9.2 PROD database. Its partitioned on a column M_c1, date column. There are 62 partitions. It has several indexes and indexes are partitioned as well.
There is a query which uses this table and gives following explain plan.
As it can be seen, there are 3 full table access for M. Lookup table is having 2000 rows only, so is not a major concern, i believe. Lookup table is accessed via views.
| Id | Operation | Name | Rows | Bytes | Cost | Pstart| Pstop | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 3 | 225 | 11562 | | | | | |
| 1 | WINDOW BUFFER | | 3 | 225 | 11562 | | | | | |
| 2 | SORT ORDER BY | | 3 | 225 | 11562 | | | 92,16 | P->S | QC (ORDER) |
| 3 | VIEW | | 3 | 225 | 11559 | | | 92,15 | P->P | RANGE |
| 4 | SORT UNIQUE | | 3 | 345 | 11559 | | | 92,15 | PCWP | |
| 5 | UNION-ALL | | | | | | | 92,14 | P->P | HASH |
| 6 | SORT GROUP BY | | 1 | 113 | 1043 | | | 92,14 | PCWP | |
| 7 | SORT GROUP BY | | 1 | 113 | 1043 | | | 92,11 | P->P | HASH |
|* 8 | HASH JOIN | | 1 | 113 | 1036 | | | 92,11 | PCWP | |
| 9 | MERGE JOIN CARTESIAN | | 1 | 64 | 48 | | | 92,00 | S->P | BROADCAST |
| 10 | MERGE JOIN CARTESIAN | | 1 | 44 | 36 | | | | | |
| 11 | MERGE JOIN CARTESIAN | | 1 | 24 | 24 | | | | | |
| 12 | VIEW | view | 1 | 12 | 12 | | | | | |
| 13 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 14 | FILTER | | | | | | | | | |
|* 15 | TABLE ACCESS FULL | lookup table | 1 | 91 | 6 | | | | | |
| 16 | BUFFER SORT | | 1 | 12 | 24 | | | | | |
| 17 | VIEW | view | 1 | 12 | 12 | | | | | |
| 18 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 19 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
| 20 | BUFFER SORT | | 1 | 20 | 24 | | | | | |
| 21 | VIEW | view | 1 | 20 | 12 | | | | | |
| 22 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 23 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
| 24 | BUFFER SORT | | 1 | 20 | 36 | | | | | |
| 25 | VIEW | | 1 | 20 | 12 | | | | | |
| 26 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 27 | TABLE ACCESS FULL | lookup table | 1 | 91 | 6 | | | | | |
| 28 | PARTITION RANGE ITERATOR| | | | | KEY | KEY | 92,11 | PCWP | |
|* 29 | TABLE ACCESS FULL | M | 18149 | 868K| 988 | KEY | KEY | 92,11 | PCWP | |
| 30 | SORT GROUP BY | | 1 | 116 | 5258 | | | 92,14 | PCWP | |
| 31 | SORT GROUP BY | | 1 | 116 | 5258 | | | 92,12 | P->P | HASH |
|* 32 | HASH JOIN | | 1 | 116 | 5251 | | | 92,12 | PCWP | |
|* 33 | HASH JOIN | | 1 | 96 | 5239 | | | 92,12 | PCWP | |
|* 34 | HASH JOIN | | 8 | 608 | 5227 | | | 92,12 | PCWP | |
|* 35 | HASH JOIN | | 116 | 7424 | 5215 | | | 92,12 | PCWP | |
| 36 | VIEW | view | 1 | 12 | 12 | | | 92,01 | S->P | BROADCAST |
| 37 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 38 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
|* 39 | HASH JOIN | | 3489 | 177K| 5203 | | | 92,12 | PCWP | |
| 40 | VIEW | view | 1 | 12 | 12 | | | 92,02 | S->P | BROADCAST |
| 41 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 42 | FILTER | | | | | | | | | |
|* 43 | TABLE ACCESS FULL| lookup tabl | 1 | 91 | 6 | | | | | |
| 44 | PARTITION RANGE ALL | | | | | 1 | 62 | 92,12 | PCWP | |
|* 45 | TABLE ACCESS FULL | M | 111K| 4361K| 5191 | 1 | 62 | 92,12 | PCWP | |
| 46 | VIEW | view | 1 | 12 | 12 | | | 92,03 | S->P | BROADCAST |
| 47 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 48 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
| 49 | VIEW | view | 1 | 20 | 12 | | | 92,04 | S->P | BROADCAST |
| 50 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 51 | TABLE ACCESS FULL | lokup table | 1 | 91 | 6 | | | | | |
| 52 | VIEW | view | 1 | 20 | 12 | | | 92,05 | S->P | BROADCAST |
| 53 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 54 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
| 55 | SORT GROUP BY | | 1 | 116 | 5258 | | | 92,14 | PCWP | |
| 56 | SORT GROUP BY | | 1 | 116 | 5258 | | | 92,13 | P->P | HASH |
|* 57 | HASH JOIN | | 1 | 116 | 5251 | | | 92,13 | PCWP | |
|* 58 | HASH JOIN | | 1 | 96 | 5239 | | | 92,13 | PCWP | |
|* 59 | HASH JOIN | | 8 | 608 | 5227 | | | 92,13 | PCWP | |
|* 60 | HASH JOIN | | 116 | 7424 | 5215 | | | 92,13 | PCWP | |
| 61 | VIEW | view | 1 | 12 | 12 | | | 92,06 | S->P | BROADCAST |
| 62 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 63 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
|* 64 | HASH JOIN | | 3489 | 177K| 5203 | | | 92,13 | PCWP | |
| 65 | VIEW | view | 1 | 12 | 12 | | | 92,07 | S->P | BROADCAST |
| 66 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 67 | FILTER | | | | | | | | | |
|* 68 | TABLE ACCESS FULL| lookup tabl | 1 | 91 | 6 | | | | | |
| 69 | PARTITION RANGE ALL | | | | | 1 | 62 | 92,13 | PCWP | |
|* 70 | TABLE ACCESS FULL | M | 111K| 4361K| 5191 | 1 | 62 | 92,13 | PCWP | |
| 71 | VIEW | view | 1 | 12 | 12 | | | 92,08 | S->P | BROADCAST |
| 72 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 73 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
| 74 | VIEW | view | 1 | 20 | 12 | | | 92,09 | S->P | BROADCAST |
| 75 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 76 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
| 77 | VIEW | view | 1 | 20 | 12 | | | 92,10 | S->P | BROADCAST |
| 78 | SORT ORDER BY | | 1 | 91 | 12 | | | | | |
|* 79 | TABLE ACCESS FULL | lookup tabl | 1 | 91 | 6 | | | | | |
1) What is the meaning of * in first ID column of explain plan above ?
2) In so many operations, how to start reading the plan ? Can u tell me which one is first line to read ?
3) Well, above query is taking 30 mins approx to give only 13 rows at last. Need to find pain points and tune this query.
Can you please help me in this ? From where do I start for tuning this ?
Thanks.Your plan is unreadable, because you have not enclosed it within code tags.
The access and predicate information (which is what the *s refer to) is missing.
The SQL statement itself is missing.
As a minumum, provide the information like this:orcl>
orcl> explain plan for
2 select * from emp where empno=1000;
Explained.
orcl> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 2949544139
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 38 | 1 (0)| 00:00:01 |
| 1 | TABLE ACCESS BY INDEX ROWID| EMP | 1 | 38 | 1 (0)| 00:00:01 |
|* 2 | INDEX UNIQUE SCAN | PK_EMP | 1 | | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("EMPNO"=1000)
14 rows selected.
orcl> -
Need query to find repeating values, please help
I need help with SQL or whatever you guys think is the best way to do this, maybe PL/SQL.
Basically it like this, in the database 10G, there are two field for address:
ADDESS_DELVRY - street address for example would be stored here
ADDESS_DELVRY2 - apartment building, suite number or PBM would be stored here
but sometimes I see the Apartment B-123 in both fields, so I need to find those duplicates, if there is a way.
So for example:
ADDESS_DELVRY - 123 Elm Street Apartment 2B
ADDESS_DELVRY2 - Apartment 2B
This is a problem, because then the Apartment gets printed twice on the mail piece. I think there is a small percentage that have this problem and am trying to find out the best way to ID them, maybe use REG_EXP ??
Not sure, please help, thanks!Soundex works how it's designed to work, which unfortunately is a very poor approximation at words sounding the same.
Using the UTL_MATCH package is a far better way to check for similarity between strings.
Ok. Given the OPs challenge here; a simple, or messy (we don't know), data cleaning task, I think soundex was worth mentioning.
Also, the reply that "soundex don't [doesn't] work" , given a working example , I think we can safely conclude
that UTL_MATCH is way above his league.
I don't understand how the OP has better use of
SELECT UTL_MATCH.EDIT_DISTANCE('Second Avenue 12 second floor', 'second fl.') dist FROM DUAL;
DIST
20
1 row selected.than
SELECT *
FROM dual
WHERE SOUNDEX ('Second Avenue 12 second floor') = SOUNDEX ('second fl.')
X
1 row selected.given the task at hand, but all right I'm not going to argue either. -
When I try to syn either my iPhone or iPad it says that I do not have enough access priveleges to perform that operation.
Please advise.Read http://support.apple.com/kb/TS1387
-
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 -
Cannot query varray of object types-please help
I am attempting to query the "diminfo" field of the view "MDSYS.all_sdo_geom_metadata". The field is "described" as MDSYS.SDO_DIM_ARRAY, which I believe is a varray of MDSYS.SDO_DIM_ELEMENT.
I have run OTT to generate the class files, but nothing is generated for the MDSYS.SDO_DIM_ARRAY "type" (maybe because it's not really a type?). A class is generated for the SDO_DIM_ELEMENT objects.
Anyway, I have tried to query the field using both "VALUE(diminfo)" and "REF(diminfo)":
select VALUE(diminfo) from all_sdo_geom_metadata;
- or -
select REF(diminfo) from all_sdo_geom_metadata;
and I get back an ORA-904 "invalid identifier". When I remove the "VALUE" or "REF" from the query, the error goes away, and is replaced by an ORA-32162 "Read/Write method not registered" further down in the code when I try to retreive the value from the recordset:
myDimInfo = rSet->getObject(1);
Since the field type (MDSYS.SDO_DIM_ARRAY) isn't really an object type, I can see why the "Read/Write method not registered" occurs-there are no methods to register.
Can someone provide a code snippet of how to perform this query?
Thanks in advanceHi,
I am using OTT generated objects to pass them to my PL/SQL procedures as OUT parameters. When I call the registerOutParam() function, I get this error ORA-32162: Read/Write SQL method not registered.
I am calling my mapping function after creating environment and before creating my stateless connection pool. But still I am getting this exception at runtime while calling registerOutParam().
Environment* env;
env = Environment::createEnvironment(Environment::OBJECT);
MessageTOMapping(env); // Calling the mapping function here.
// Creating the stateless connection pool.
StatelessConnectionPool* scp;
scp = env->createStatelessConnectionPool("naveen",
"naveen",
"//10.105.153.11:1521/pls",
10,
5,
2,
StatelessConnectionPool::HOMOGENEOUS);
// Fetch a connection from the stateless connection pool
conn = scp->getConnection();
// After this, I create my Statement and call the registerOutParam() which
// causes ORA-32162 exception.
Please note that I do not get this error when I don't use any connection-pooling mechanism. That is, if I create an environment in OBJECT mode, call the mapping function with its pointer and create a normal Connection object (without any pooling etc), my application runs perfectly fine. E.g. if I replace the above piece of code with the code below, my application runs fine.
Environment* env;
env = Environment::createEnvironment(Environment::OBJECT);
MessageTOMapping(env); // Calling the mapping function here.
conn = env->createConnection("naveen", "naveen", "//10.105.153.11:1521/pls");
// After this, I create my Statement and call the registerOutParam() which
// does not give problem now and my application runs pefectly fine.
Can anyone let me know what I am doing wrong while using the stateless connection pooling mechanism? I definitely need to use Stateless Connection Pooling and must not get connections directly from env->createConnection().
Any help will be greatly appreciated.
Thanks and Regards,
Naveen -
Query Filling up Temp DB --Please Help
Friends, when I execute this proc it fills up the temp db very quickly. Could you guys please take a look at the attached script and help me
Create PROCEDURE Test
@loginid INT,
@companyid INT,
@streetnumber nvarchar(50) = NULL,
@streetname nvarchar(50) = NULL,
@city nvarchar(50) = NULL,
@zip nvarchar(50) = NULL,
@lastname nvarchar(50) = NULL,
@firstname nvarchar(50) = NULL,
@companyname nvarchar(50) = NULL,
@builder nvarchar(50) = NULL,
@lotnumber nvarchar(50) = NULL,
@subdivision nvarchar(50) = NULL,
@showaccount bit,
@showsite bit,
@activeonly bit = NULL,
@branchType int,
@BranchIndex int,
@prgActive bit = NULL,
@prgCancel bit = NULL,
@prgPendingCancel bit = NULL,
@siteNational bit = NULL,
@siteResidential bit = NULL,
@siteCommercial bit = NULL,
@prgPC bit = NULL,
@prgTCTB bit = NULL,
@prgPCTCTB bit = NULL
AS
BEGIN
DECLARE @sql nvarchar(MAX),
@paramlist nvarchar(4000)
SELECT @sql =
N' SET NOCOUNT ON
CREATE TABLE #temp
accountid int, siteid int, contactid int,phoneid int,addressid int, haspc bit, hastctb bit, branchid int
create index tmpaccountid on #temp(accountid)
create index tmpsiteid on #temp(siteid)
create index tmpcontactid on #temp(contactid)
create index tmpphoneid on #temp(phoneid)
create index tmpaddressid on #temp(addressid)
create index tmpbranchid on #temp(branchid)
IF @showaccount=1 BEGIN
INSERT INTO #temp (accountid,siteid,contactid,phoneid,addressid,branchid)
SELECT distinct taccount.accountid, isnull(taccountsite.siteid,0), tcontact.contactid,
tcontactphonenumber.phoneid,taddress.addressid, taccount.billingcenterid
FROM taddress with (nolock) INNER JOIN
taccount with (nolock) ON taddress.addressid = taccount.billingaddressid INNER JOIN
tlogincompanybranch ON taccount.billingcenterid = tlogincompanybranch.branchid INNER JOIN
tcontact ON taccount.primarycontactid = tcontact.contactid LEFT JOIN
tcontactphonenumber ON tcontactphonenumber.phoneid = tcontact.primaryphoneid
LEFT JOIN taccountsite ON taccountsite.accountid = taccount.accountid
LEFT JOIN tsite ON taccountsite.siteid = tsite.siteid
if (@builder is not null) or (@lotnumber is not null) or (@subdivision is not null)
begin
SELECT @sql = @sql + ' LEFT JOIN tbuilder on tsite.builderid = tbuilder.builderid
LEFT JOIN tcontact bc ON tbuilder.primarycontactid = bc.contactid '
end
if @branchType = 1
begin
SELECT @sql = @sql + ' INNER JOIN testimate est ON est.siteid = tsite.siteid
INNER JOIN tlogincompanybranch svccenterbranch on est.servicecenter=svccenterbranch.branchid and svccenterbranch.loginid = @loginid '
end
SELECT @sql = @sql + ' WHERE taccount.companyid = @companyid and tlogincompanybranch.loginid=@loginid '
if @branchType = 1 and @branchIndex <> 0
begin
SELECT @sql = @sql + ' AND est.servicecenter = @branchIndex '
end
if @activeonly is not null
begin
SELECT @sql = @sql + ' AND taccount.isactive <> 0 '
end
if @lastname is not null
begin
SELECT @sql = @sql + ' AND upper(tcontact.lastname) LIKE @lastname + ''%'''
--SELECT @sql = @sql + ' AND upper(tcontact.lastname) LIKE N' + quotename(@lastname + '%', '''')
end
if @firstname is not null
begin
SELECT @sql = @sql + ' AND upper(tcontact.firstname) LIKE @firstname + ''%'''
end
if @companyname is not null
begin
SELECT @sql = @sql + ' AND upper(tcontact.businessname) LIKE @companyname + ''%'''
end
if @streetnumber is not null
begin
SELECT @sql = @sql + ' AND taddress.streetnumber = @streetnumber '
end
if @streetname is not null
begin
SELECT @sql = @sql + ' AND upper(taddress.streetname) LIKE @streetname + ''%'''
end
if @city is not null
begin
SELECT @sql = @sql + ' AND upper(taddress.city) LIKE @city + ''%'''
end
if @zip is not null
begin
SELECT @sql = @sql + ' AND taddress.postalcode LIKE @zip + ''%'''
end
if @builder is not null
begin
SELECT @sql = @sql + ' AND upper(bc.businessname) LIKE ''%'' + @builder + ''%'''
end
if @lotnumber is not null
begin
SELECT @sql = @sql + ' AND upper(tsite.lotnumber) LIKE @lotnumber '
end
if @subdivision is not null
begin
SELECT @sql = @sql + ' AND upper(tsite.subdivision) LIKE @subdivision + ''%'''
end
if (@siteNational is not null) or (@siteResidential is not null) or (@siteCommercial is not null)
begin
SELECT @sql = @sql + ' AND ( '
if @siteResidential is not null
begin
SELECT @sql = @sql + ' tsite.propertytype = 1 '
end
if @siteCommercial is not null
begin
if (@siteCommercial is not null) and (@siteResidential is not null)
begin
SELECT @sql = @sql + ' OR tsite.propertytype = 2 '
end
else
begin
SELECT @sql = @sql + ' tsite.propertytype = 2 '
end
end
if @siteNational is not null
begin
if (@siteNational is not null) and ((@siteResidential is not null) or (@siteCommercial is not null))
begin
SELECT @sql = @sql + ' OR tsite.propertytype = 5 '
end
else
begin
SELECT @sql = @sql + ' tsite.propertytype = 5 '
end
end
SELECT @sql = @sql + ' ) '
end
if @branchType = 2
begin
SELECT @sql = @sql + ' AND taccount.billingcenterid = @BranchIndex '
end
SELECT @sql = @sql + ' END '
SELECT @sql = @sql + ' IF @showsite = 1 BEGIN
INSERT INTO #temp (accountid,siteid,contactid,phoneid,addressid, branchid)
SELECT distinct taccountsite.accountid,tsite.siteid,tsite.primarycontactid,
isnull(tcontactphonenumber.phoneid, 0),taddress.addressid,0
FROM taccountsite INNER JOIN
taccount a on a.accountid=taccountsite.accountid INNER JOIN
tlogincompanybranch on a.billingcenterid=tlogincompanybranch.branchid INNER JOIN
tsite with (nolock) ON taccountsite.siteid = tsite.siteid INNER JOIN
taddress with (nolock) ON tsite.addressid = taddress.addressid INNER JOIN
tcontact ON tsite.primarycontactid = tcontact.contactid LEFT JOIN
tcontactphonenumber ON tcontact.primaryphoneid = tcontactphonenumber.phoneid '
if @builder is not null
begin
SELECT @sql = @sql + ' LEFT JOIN tbuilder ON tsite.builderid = tbuilder.builderid
LEFT JOIN tcontact bc ON tbuilder.primarycontactid = bc.contactid '
end
if @branchType = 1
begin
SELECT @sql = @sql + ' INNER JOIN testimate est ON est.siteid = tsite.siteid
INNER JOIN tlogincompanybranch svccenterbranch on est.servicecenter=svccenterbranch.branchid and svccenterbranch.loginid = @loginid '
end
SELECT @sql = @sql + ' WHERE taddress.companyid = @companyid and tlogincompanybranch.loginid=@loginid '
if @activeonly is not null
begin
SELECT @sql = @sql + ' AND a.isactive <> 0 '
end
if @lastname is not null
begin
SELECT @sql = @sql + ' AND upper(tcontact.lastname) LIKE @lastname + ''%'''
--SELECT @sql = @sql + ' AND upper(tcontact.lastname) LIKE N' + quotename(@lastname + '%', '''')
end
if @branchType = 1 and @branchIndex <> 0
begin
SELECT @sql = @sql + ' AND est.servicecenter = @branchIndex '
end
if @firstname is not null
begin
SELECT @sql = @sql + ' AND upper(tcontact.firstname) LIKE @firstname + ''%'''
end
if @companyname is not null
begin
SELECT @sql = @sql + ' AND upper(tcontact.businessname) LIKE @companyname + ''%'''
end
if @streetnumber is not null
begin
SELECT @sql = @sql + ' AND taddress.streetnumber = @streetnumber '
end
if @streetname is not null
begin
SELECT @sql = @sql + ' AND upper(taddress.streetname) LIKE @streetname + ''%'''
end
if @city is not null
begin
SELECT @sql = @sql + ' AND upper(taddress.city) LIKE @city + ''%'''
end
if @zip is not null
begin
SELECT @sql = @sql + ' AND taddress.postalcode LIKE @zip + ''%'''
end
if @builder is not null
begin
SELECT @sql = @sql + ' AND upper(bc.businessname) LIKE ''%'' + @builder + ''%'''
end
if @lotnumber is not null
begin
SELECT @sql = @sql + ' AND upper(tsite.lotnumber) LIKE @lotnumber '
end
if @subdivision is not null
begin
SELECT @sql = @sql + ' AND upper(tsite.subdivision) LIKE @subdivision + ''%'''
end
if (@siteNational is not null) or (@siteResidential is not null) or (@siteCommercial is not null)
begin
SELECT @sql = @sql + ' AND ( '
if @siteResidential is not null
begin
SELECT @sql = @sql + ' tsite.propertytype = 1 '
end
if @siteCommercial is not null
begin
if (@siteCommercial is not null) and (@siteResidential is not null)
begin
SELECT @sql = @sql + ' OR tsite.propertytype = 2 '
end
else
begin
SELECT @sql = @sql + ' tsite.propertytype = 2 '
end
end
if @siteNational is not null
begin
if (@siteNational is not null) and ((@siteResidential is not null) or (@siteCommercial is not null))
begin
SELECT @sql = @sql + ' OR tsite.propertytype = 5 '
end
else
begin
SELECT @sql = @sql + ' tsite.propertytype = 5 '
end
end
SELECT @sql = @sql + ' ) '
end
if @branchType = 2
begin
SELECT @sql = @sql + ' AND taccount.billingcenterid = @BranchIndex '
end
SELECT @sql = @sql + ' END '
if (@prgActive is not null) or (@prgCancel is not null) or (@prgPendingCancel is not null)
begin
SELECT @sql = @sql + ' delete tmp
from #temp tmp
left join testimate e on e.siteid = tmp.siteid
left join tprogram p on p.estimateid = e.estimateid
where p.programid IS NULL '
if @prgActive is null
begin
SELECT @sql = @sql + ' OR (p.canceldate is null and p.pendingcanceldate is null) '
end
if @prgCancel is null
begin
SELECT @sql = @sql + ' OR p.canceldate is not null '
end
if @prgPendingCancel is null
begin
SELECT @sql = @sql + ' OR p.pendingcanceldate is not null '
end
end
SELECT @sql = @sql + ' ;WITH counts AS
SELECT
tmp.accountid,
pccount = SUM(CASE WHEN ps.reportcategory = 1 THEN 1 ELSE 0 END),
tctbcount = SUM(CASE WHEN ps.reportcategory = 3 THEN 1 ELSE 0 END)
FROM
#temp tmp
INNER JOIN testimate e ON e.siteid = tmp.siteid
INNER JOIN tprogram p ON p.estimateid = e.estimateid
INNER JOIN tprogramsetup ps ON ps.programtypeid = p.programtypeid
GROUP BY tmp.accountid
UPDATE #temp
SET haspc = CASE WHEN c.pccount > 0 THEN 1 ELSE 0 END,
hastctb = CASE WHEN c.tctbcount > 0 THEN 1 ELSE 0 END
FROM #temp tmp
INNER JOIN counts c ON c.accountid = tmp.accountid '
if (@prgPC is not null) or (@prgTCTB is not null) or (@prgPCTCTB is not null)
begin
SELECT @sql = @sql + ' DELETE
FROM #temp
WHERE (haspc = 0 AND hastctb = 0) OR (haspc IS NULL OR hastctb IS NULL) '
if @prgPC is null
begin
SELECT @sql = @sql + ' OR (haspc = 1 AND hastctb = 0)'
end
if @prgTCTB is null
begin
SELECT @sql = @sql + ' OR (haspc = 0 AND hastctb = 1)'
end
if @prgPCTCTB is null
begin
SELECT @sql = @sql + ' OR (haspc = 1 AND hastctb = 1)'
end
end
SELECT @sql = @sql + ' IF @showaccount=1 AND @showsite = 0 BEGIN
SELECT DISTINCT taccount.accountnum,taccount.isactive, b.branchname, 0 as siteid, isnull(max(tcontact.firstname),'''') as firstname,isnull(max(tcontact.lastname),'''') as lastname,
isnull(max(tcontact.businessname),'''') as businessname,max(taddress.streetnumber) as streetnumber,
max(taddress.predirection) as predirection ,isnull(max(taddress.streetname),'''') as streetname,max(taddress.streetsuffix) as streetsuffix,max(taddress.postdirection) as postdirection,
isnull(max(taddress.city),'''') as city,isnull(max(taddress.state),'''') as state,max(taddress.postalcode) as postalcode,isnull(taccount.mysearch,'''') as mysearch,taccount.accountid,
isnull(max(tsite.lotnumber),'''') as lotnumber, haspc=CONVERT(BIT,ISNULL(haspc,0)), hastctb=CONVERT(BIT,ISNULL(hastctb,0))
FROM #temp INNER JOIN taccount ON #temp.accountid = taccount.accountid
LEFT JOIN tcontact ON #temp.contactid = tcontact.contactid
LEFT JOIN taddress ON #temp.addressid = taddress.addressid
LEFT JOIN taccountsite ON taccountsite.accountid=taccount.accountid
LEFT JOIN tsite ON (taccountsite.siteid = tsite.siteid and tsite.addressid=taddress.addressid )
LEFT JOIN tbranch b ON (taccount.billingcenterid = b.branchid)
if @branchType = 1
begin
SELECT @sql = @sql + ' LEFT JOIN testimate est ON est.accountid = taccount.accountid '
if @BranchIndex <> 0
begin
SELECT @sql = @sql + ' AND est.servicecenter = @BranchIndex '
end
SELECT @sql = @sql + ' GROUP BY taccount.accountnum, #temp.siteid, tcontact.firstname, tcontact.lastname,
tcontact.businessname, taddress.streetnumber, taddress.predirection, taddress.streetname, taddress.streetsuffix, taddress.postdirection, taddress.city, taddress.state, taddress.postalcode, taccount.mysearch, taccount.accountid, taccount.isactive, haspc, hastctb, b.branchname
HAVING count(est.servicecenter) > 0 '
end
else
begin
if @branchType = 2
begin
SELECT @sql = @sql + ' WHERE taccount.billingcenterid = @BranchIndex '
end
SELECT @sql = @sql + ' GROUP BY taccount.accountid, taccount.isactive,taccount.accountnum,taccount.mysearch, haspc, hastctb,b.branchname '
SELECT @sql = @sql + ' ORDER BY taccount.accountnum '
end
SELECT @sql = @sql + ' END ELSE BEGIN
SELECT DISTINCT taccount.accountnum,taccount.isactive, case when billingbranch.branchname is not null and @showaccount = 1 then billingbranch.branchname else isnull(b.branchname,'''') end as branchname, case when #temp.branchid = 0 then #temp.siteid else 0 end as siteid, isnull(tcontact.firstname,'''') as firstname,isnull(tcontact.lastname,'''') as lastname,
isnull(tcontact.businessname,'''') as businessname,taddress.streetnumber,
taddress.predirection,isnull(taddress.streetname,'''') as streetname,taddress.streetsuffix,taddress.postdirection,
isnull(taddress.city,'''') as city,isnull(taddress.state,'''') as state,taddress.postalcode,isnull(taccount.mysearch,'''') as mysearch,taccount.accountid,
isnull(max(tsite.lotnumber),'''') as lotnumber, haspc=CONVERT(BIT,ISNULL(haspc,0)), hastctb=CONVERT(BIT,ISNULL(hastctb,0))
FROM #temp INNER JOIN taccount ON #temp.accountid = taccount.accountid
LEFT JOIN tcontact ON #temp.contactid = tcontact.contactid
LEFT JOIN taddress ON #temp.addressid = taddress.addressid
LEFT JOIN taccountsite ON taccountsite.accountid=taccount.accountid
LEFT JOIN tsite ON (taccountsite.siteid = tsite.siteid and tsite.addressid=taddress.addressid )
LEFT JOIN testimate est ON est.siteid = tsite.siteid
LEFT JOIN tbranch b ON (est.servicecenter = b.branchid)
LEFT JOIN tbranch billingbranch ON (#temp.branchid = billingbranch.branchid)
if @branchType = 1
begin
if @BranchIndex <> 0
begin
SELECT @sql = @sql + ' AND est.servicecenter = @BranchIndex '
end
SELECT @sql = @sql + ' GROUP BY taccount.accountnum,taccount.isactive, #temp.siteid, tcontact.firstname, tcontact.lastname,tcontact.businessname, taddress.streetnumber,
taddress.predirection,taddress.streetname, taddress.streetsuffix,taddress.postdirection,taddress.city, taddress.state, taddress.postalcode,taccount.mysearch, taccount.accountid, haspc, hastctb, b.branchname, billingbranch.branchname, #temp.branchid
HAVING (count(est.servicecenter) > 0 or billingbranch.branchname is not null) '
end
else
begin
if @branchType = 2
begin
SELECT @sql = @sql + ' WHERE taccount.billingcenterid = @BranchIndex '
end
SELECT @sql = @sql + ' GROUP BY taccount.accountid, taccount.isactive,taccount.accountnum, tcontact.firstname, tcontact.lastname,
tcontact.businessname, #temp.siteid,
taddress.streetnumber, taddress.predirection, taddress.streetname,
taddress.streetsuffix, taddress.postdirection,taddress.city, taddress.state,
taddress.postalcode,taddress.postalcodeex,taccount.mysearch, haspc, hastctb, b.branchname, billingbranch.branchname, #temp.branchid '
end
SELECT @sql = @sql + ' ORDER BY taccount.accountnum
END
DROP TABLE #temp
SET NOCOUNT OFF '
SELECT @paramlist = N' @loginid INT,
@companyid INT,
@streetnumber nvarchar(100),
@streetname nvarchar(50),
@city nvarchar(50),
@zip nvarchar(50),
@lastname nvarchar(50),
@firstname nvarchar(50),
@companyname nvarchar(50),
@builder nvarchar(50),
@lotnumber nvarchar(50),
@subdivision nvarchar(50),
@showaccount bit,
@showsite bit,
@activeonly bit,
@branchType int,
@BranchIndex int,
@prgActive bit,
@prgCancel bit,
@prgPendingCancel bit,
@siteNational bit,
@siteResidential bit,
@siteCommercial bit,
@prgPC bit,
@prgTCTB bit,
@prgPCTCTB bit '
EXEC sp_executesql @sql, @paramlist,
@loginid, @companyid, @streetnumber, @streetname, @city, @zip, @lastname, @firstname, @companyname, @builder,
@lotnumber, @subdivision, @showaccount, @showsite, @activeonly, @branchType, @BranchIndex, @prgActive,
@prgCancel,@prgPendingCancel, @siteNational, @siteResidential, @siteCommercial, @prgPC, @prgTCTB, @prgPCTCTB
ENDDoes it fill up tempdb, no matter which parameters you provide?
Narrow down which conditions that cause the procedure to fail. Add a @debug parameter and
IF @debug = 1
PRINT @sql
Take a look at that SQL, and see if it looks OK. Maybe you have an incorrect condition somewhere?
You can also create a temporary procedure from the generated SQL, and then run it, to see more what is happening.
If nothing stands out, try reducing the query until tempdb stays in check.
Since you create temp tables, there are two possible reasons (at least) why tempdb fills up:
1) You are inserting too much data into the temp tables (for instance because of a poorly written join).
2) The query generates a worktable which overflows.
I don't think anyone wants to try to read and understand your dynamic SQL code, but hopefully these tips helps you with the troubleshooting.
Erland Sommarskog, SQL Server MVP, [email protected] -
Query strange behaviour...please help...
Dear All,
I do have one query having two where conditions and group by and an order by ..
The problem is i run with particular combition of column values in where...oracle is exiting from sqlplus..(i.e disconnected)..
if i change where cluase combition which working fine...the problem is only for particular combination of where clause columns..(which more than 2 million records)..
Even i tested saperately the groupby and order by..it is working fine..
I am using 10g..really dont understand this oracle behaviour..
Please suggest...
Thanks
OnenessboyIt 's like - you have given all the ingredients and follow the exact process to cook a special item - but forget to open the fire.
Where is your code? How do we investigate your problem?
Please post your table's DDL and some test data in form of DML and also post your exact DB version with proper format.
Got me?
Regards.
Satyaki De. -
Hi guys,
You have been a real help in the past so i'm hoping you can be again.
I am importing a largish WAV file into audition from a soundcloud download and each time the pitch is very high and the speed has increased.
I dont know why this is happening and I have never encountered this problem before.
File is fine and plays ok outside audition.
Are you help me fix this issue as it is quite urgent..?
Thanks very much,
Dave.without knowing for sure why you got the problem, it's not possible to give salient advice.
yes, adobe, audacity, switch, iTunes will all do the conversion for you.
you could also use audacity to export as an mp3 too, as well as edit it.
ideally, sample rates should change rarely, i.e. you should work at the rate of the file, where possible.
but it seems you were using mixed sample rates and the DAW you used had issues with the differences.
for quick conversions use iTunes, change the cd import settings to what you want, and you can convert selected audio files to that cd import setting.
XLD is highly thought of, does a similar thing.
BTW, you rightly surmise that Audition should be powerful enough, i don't know it but it surely can do all the things you are asking... look for import or convert in the menu -
SQL Between Query....Urgent Please Help ..
Hi,
Can any one solve my problem.
Iam having two numaric columns in my database table. I like to retrive
them in the specific range.
The Example Table is.
Table Name is : SR_Table
testDate(numeric) testTime(numeric)
1 1
1 2
1 3
1 4
1 5
1 6
2 1
2 2
2 3
2 4
Infact i like to get the records between testDate = 1 and testTime = 2
and testDate = 2 and testTime = 3
Iam using the sql query as:
select * from SR_Table where testdate between '1' and '2' and testtime between '2' and '4'..
instead of giving 9 records its just giving 6 records ... it maight me a mistake in my query. the output for the above query is:
testDate(numeric) testTime(numeric)
1 2
1 3
1 4
2 2
2 3
2 4
The records
1 5
1 6
2 1 are missing...
infact iam expecting 9 records as
testDate(numeric) testTime(numeric)
1 2
1 3
1 4
1 5
1 6
2 1
2 2
2 3
2 4
Please solve my problem for using BETWEEN together in two coloumns.
Thanks,
Srinivas MannavaLooks like there's a few ways to approach this, depending on your data.
If you are truly wanting values between a given range, and you have a different range for each column, then modifying your query as suggested by DrClap should work properly.select * from SR_Table
where (testdate > 0 and testdate < 3)
and (testtime > 1 and testtime < 5)
// > 0 and < 3 means 1 or 2
// > 1 and < 5 means 2, 3, or 4Looking at your example again, however, it appears that you are wanting both values together to act as a single key. Your example data would then contain the values 11 - 16 and 21 - 24.
If this is the case, then you're going to have to get a little more complicated, and implementation may depend on the database that you are using.
If your sample data is representative of your real data (nothing but INT values) then it won't be too bad (this is an Oracle implementation):select [other_fields], TO_NUMBER(testdate || testtime) as test
from SR_Table
where test > 11 and test < 17 and test > 20 and test < 25If your data is more complex, then the query becomes more complex and we'll really need to know exactly what you're trying to do. -
Performance Tunning - Could anyone please help
I have a procedure which uses two offensive queries.The currenttime its taking is approximately 2 min in DEV and in PROD 20 min.
Target is to reduce time to less than a minute in DEV and max 5 min in PROD.
PROBLEM1######################### I think nothing much can be done here.
Correct me in case I am wrong.
Insert into TEMP_A ===> Global Temporary table
(col1,
col2,
col3,
col4,
col5,
col6,
col7,
col8,
col9,
col10,
col11,
col12,
col13,
col14)
Select distinct
o.value1
,decode (staticvalue1, 1,o.value2,NULL) ==> Static values are populated from some other table
,decode (staticvalue2,2,o.value2,NULL)
,o.value4
,o.value5
,decode (staticvalue3,1,o.value3,NULL)
,decode (staticvalue4,1,o.value4,NULL)
,decode (staticvalue5,1,o.value5,NULL)
,decode (staticvalue6,1,o.value6,NULL)
,decode (staticvalue7,1,o.value7,NULL)
,e.value1
,e.value2
,e.value3
,e.value4
from table1 o ==> Big table having 100000(1L) records daily transacational table
table2 e==> Big table having 2L records daily transactional table
table3 oe ==> small table of 14000 records
table4 ji ==> Just 500 records
where ji.id= static value==> passed as input to procedure and 1 record is retried for that id
and ji.col1= oe.col1
and oe.TIMESTAMP >=ji.TIMESTAMP
and o.TIMESTAMP < ji.TIMESTAMP+1
and o.orderid =OE.orderid
and e.eventid = oe.eventid
and e.TIMESTAMP >=ji.TIMESTAMP
and e.TIMESTAMP < ji.TIMESTAMP+1
table1 o ==> Indexed with orderid, TIMESTAMP
table2 e ==> Indexed with eventid, TIMESTAMP
After these are fed, a very small manipulation to TEMP_A ==> Global temp table
Then major offensive insert is fired.
By now TEMP_A contains 1500 records.
PROBLEM2######################################################################
Insert into TABLE5
(a,b,c,d,e,f,g,h,i,j,k,l,m)
select
hardcode value1,
hardcode value2,
c.value1
c.value2
c.value3
c.value4
MAX(TRUNC(e.TIMESTAMP))
decode(staticvalue,0,MAX(e.TIMESTAMP)
,1,MIN(e.TIMESTAMP)
SUM(e.value5) as quantity,
SUM(e.value6 * e.val7)/SUM e.value6 as price
decode(staticvalue,0,SUM(e.value5*e.val7)/SUM (e.value6),
1,ROUND(SUM(e.value5*e.val7)/SUM (e.value6), 4),
2,TRUNC(SUM(e.value5*e.val7)/SUM (e.value6), 4)) as consider
SYSDATE
'APP_NAME'
FROM
table1 o ==> Big table having 100000(1L) records daily transacational table(same tables as above)
table2 e==> Big table having 2L records daily transactional table(same tables as above)
table3 oe ==> small table of 14000 records(same tables as above)
table4 ji ==> Just 500 records (same tables as above)
TEMP_A c ( which is the same TEMP table populated earlier)
WHERE
ji.id= static value==> passed as input to procedure and 1 record is retried for that id
and ji.col1= oe.col1
and oe.TIMESTAMP >=ji.TIMESTAMP
and o.TIMESTAMP < ji.TIMESTAMP+1
and o.orderid =OE.orderid
and e.eventid = oe.eventid
and e.TIMESTAMP >=ji.TIMESTAMP
and e.TIMESTAMP < ji.TIMESTAMP+1
GROUP BY
c.value1
c.value2
c.value3
c.value4
The temp_A table is not indexed and its written as CREATE Global temporary ***** on commit preserve rows.
The SQL trace of the second problem as follows.
| Id | Operation | Name | Rows |
Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 1 |
428 | 30 (7)| 00:00:01 | | |
| 1 | SORT GROUP BY | | 1 |
428 | 30 (7)| 00:00:01 | | |
|* 2 | TABLE ACCESS BY LOCAL INDEX ROWID| table1 | 1 |
18 | 15 (0)| 00:00:01 | | |
| 3 | NESTED LOOPS | | 1 |
428 | 29 (4)| 00:00:01 | | |
|* 4 | HASH JOIN | | 1 |
410 | 14 (8)| 00:00:01 | | |
| 5 | NESTED LOOPS | | 4 |
860 | 8 (0)| 00:00:01 | | |
| 6 | TABLE ACCESS BY INDEX ROWID | table3 | 1 |
16 | 2 (0)| 00:00:01 | | |
|* 7 | INDEX UNIQUE SCAN | PK_table3 | 1 |
| 1 (0)| 00:00:01 | | |
|* 8 | TABLE ACCESS FULL | Table4 | 4 |
796 | 6 (0)| 00:00:01 | | |
| 9 | TABLE ACCESS FULL | TEMP_A | 1648 |
313K| 5 (0)| 00:00:01 | | |
| 10 | PARTITION RANGE ALL | | 1 |
| 14 (0)| 00:00:01 | 1 | 14 |
|* 11 | INDEX RANGE SCAN | PK_table2 | 1 |
| 14 (0)| 00:00:01 |
If other than global temporary table, problem can be resolved, also suggest for the same.hi ,
perhaps you might want to try the insert into /*+ APPEND */ table_name or using SQL Loader (but i have not used it before though)
What i know of the APPEND hints is it reduces the logging but it should be recommend for inserting records of huge size as it moves pointer above the High-Water-Mark (i.e i think that some spaces will be wasted for those below the HWM)
hope that might help
tks & rgds
Maybe you are looking for
-
Who can help me with unknown error 0xE800005E
After updating itunes to 10.6 and my iphone to iOS 5 my iphone got trouble syncing with my computer. I was able to connect at first but halfway a sync I was disconnected and got the message: iTunes could not connect to this iPhone because an unknown
-
Hello -I have windows 8 server and windows xp clients. I used to be able to remote into server usung remote desktop. Now, I get an error saying that I must be a member of remote desktop user group ( I am ) or your must be added manually. How do I man
-
How can I use ipad to extend desktop?
I would like to use my ipad to extend my macbook desktop, dual screen concept.
-
Installing Lightroom on a second mac
We purchased Lightroom for our Mac and Mac Pro. We installed the first and cannot figure out how to install the second. HELP! Thanks Carolyn
-
InDesign CS6 crashes all the time while importing an image
InDesign CS6 crashes all the time while importing an image. Does anybody knows what's going on? How can I solve this problem. Please help me cause I can't work. Thanks a lot!