Query to run as less exposed
Hi guys,.I have a question to ask. I need to extract the last issued a table pieces. Table stores the question and unissue parts.
for example let's say 4 items have been issued and 3 items were not issued a table. so in elements last 1 should be allowed. while I am running following code its not working properly.
Data in the table:
REPAIRED_ITEM_ID ISSUED_REMOVED_ PART_ID Oper_ID QTY
122013187 1323938 308 1
122013187 1323938 308 1
122013187 1323938 309 1
122013187 1323940 308 1
122013187 1323940 308 1
122013187 1323940 309 1
122013187 1323940 309 1
SELECT * FROM WC1.ISSUED_REMOVED_ITEM IRI
WHERE
IRI.ORDER_ITEM_OPER_ID = 308
AND IRI.SES_CUSTOMER_ID =1
AND IRI.REPAIRED_ITEM_ID = 122013187
AND 0 = (SELECT COUNT(1)
FROM WC1.ISSUED_REMOVED_ITEM U
WHERE U.REPAIRED_ITEM_ID = IRI.REPAIRED_ITEM_ID
AND U.ORDER_ITEM_OPER_ID = 309
AND U.SES_CUSTOMER_ID= 1
)
But the query above does not display any result, whereas it should show 1 record 1323938, can someone please explain me how to get this good result?Note: The repair item id is unique to the MAIN UNIT. which may contain several question and UN-question of dependent units.
Thank you very much
M.C.
Published by: BluShadow on 06-Sep-2012 13:19
addition of {noformat}
{noformat} tags to help readability. Please read {message:id=9360002} and learn to post questions with format in future.
Mark Cooper wrote:
Did you mean that you did not understand the problem?
I know that I absolutely do not understand the problem. Please see the thread that BluShadow added to your original post.
Tags: Database
Similar Questions
-
Problem with Apex 5.0 report with a query that runs in SQL Developer
Hello
I have a query that runs in SQL Developer without problem, but when I use it in a classic report, it displays following:
error report:
ORA-06502: PL/SQL: digital or value error: character of number conversion error
The query is:
select T1.ID_ATTACHMENT, T1.BLOB_CONTENT, T2.ATTACH_CATEGORY, T1.FILENAME, T1.ATTACHMENT_DESCRIPTION from ATTACHMENTS T1 LEFT JOIN REF_ATTACH_CATEGORIES T2 ON T1.ATTACHMENT_CATEGORY = T2.ID_ATTACH_CATEGORY WHERE T1.ID_ATTACHMENT IN (SELECT ID_ATTACHMENT FROM REL_ATTACHMENTS WHERE REL_PART_ID = 1 AND REL_ID = 64146);
And the output of SQL Developer is:
I have following Setup for the BLOB_CONTENT column in the classic report:
Any ideas what is causing this problem?
Thanks in advance,
Sergio
I don't have notes with me, but I think that the content of the blob must be selected as:
DBMS_LOB. GetLength (blob_content) as blob_content
and check that you have included the primary key in the results.
-
After importing the files in lightroom cc2015.2, they are all less exposed and developing the show exposure to-5. Help, please.
Hi paulw,
For existing images whose exposure have changed, please select all and go to photo > develop settings > reset.
For import next session, please follow the steps below:
- Turn off apply tone auto under Lightroom preferences settings
- Restart Lightroom and then import images again.
Concerning
Sarika
-
How export (unload) result of the query without running query on sql developer
Hello
I want to know how export (unload) result of the query without running query on sql developer.
I know this way.
1. execution of query
2. click on "Download" on the results tab
http://i.stack.imgur.com/CQ4Qb.jpg
Is he available unload a query result before the race?No, but you can do this ask the developer SQL change however, for other users can vote and add weight to the possible future implementation.
Kind regards
K. -
Void query causes the query to run forever
Here are the two original requests that I started with. They refer to the correct when executed separately results but when combined it causes the query to run and run and run and run forever. I try to delete the query results of query 2 1 with a statement of "not in". 3 is the query that runs always with this 'not in' statement that runs forever. Please help me! *!
-Request 1
SELECT DISTINCT
S.NAME,
S.RRN,
RTRIM (LTRIM (S.STREET_NBR) |) ' ' ||
RTRIM (SUBSTR (S.STREET, 33, 2)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 1, 28)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 29, 4)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 35, 2))) | ' ' ||
NVL2 (S.UNIT_NBR, ' #',' ') | ' ' ||
ADDRESS LTRIM (S.UNIT_NBR),
CITY OF S.CITY_NAME,
S.STPV_CODE STATE,
RTRIM (S.ZIP_CODE) |
'-'||
S.ZIP_PLUS4 ZIP,
S.HOME_PHONE,
S.ACCT_NBR,
TO_CHAR (S.EXPR_DATE, 'MMDDYY') START_DATE,
TO_CHAR ((P.EFF_DATE-1), 'MMDDYY') END_DATE.
TO_CHAR(SYSDATE,'MMDDYY') FILE_DATE,
ROUND ((-1 * (S.BALANCE_AMT + (S.BALANCE_AMT*.06) + S.DLVF_AMT)) * 100) TO BALANCE.
S.STAT_FLAG,
MIN (P.SEQ_CTR)
Of
THE DISCUS THROW. SUB_SUN S,.
THE DISCUS THROW. TRN_STP_SUN P,.
THE DISCUS THROW. TRN_MEM_SUN M.
(SELECT
SUB_RRN,
TRAN_CODE,
EFF_DATE,
MIN (SEQ_CTR)
Of
THE DISCUS THROW. TRN_DLR_SUN
WHERE
TRAN_CODE = 'BILL' AND
EFF_DATE > = TRUNC (SYSDATE)-65
GROUP BY
SUB_RRN,
TRAN_CODE,
EFF_DATE,
D SEQ_CTR)
WHERE
S.RRN = P.SUB_RRN AND
S.RRN = M.SUB_RRN AND
S.RRN = D.SUB_RRN (+) AND
TRIM (P.PAPR_CODE) = "SS" AND
S.BILL_CODE NOT IN ("PRTY", "EZCC', 'EMPB', 'CTCE', 'NSPC", "NYET", "NIEF", "SAMP", "ALTP", "COMP", "CMHC", "MAIL") AND
TRIM (S.STAT_FLAG) = 'F' AND
P.TYPE = 'P' AND
P.SPRS_CODE IN ('NOPY","CHMD","SCOUT","TIME") AND
TRUNC (P.EFF_DATE) BETWEEN TRUNC (SYSDATE)-43 AND TRUNC (SYSDATE)-29 AND
S.NAME_FLAG! = 'B' AND
(S.BALANCE_AMT + (S.BALANCE_AMT*.06) + (S.DLVF_AMT)) <-6.99 AND
M.CODE! = 'DISP' AND
NOT EXIST
(SELECT
Q.HOME_PHONE
Of
THE DISCUS THROW. SUB_SUN Q
WHERE
S.HOME_PHONE = Q.HOME_PHONE AND
Q.SUBT_CODE IN ('HARD DRIVES', 'HDLV') AND
Q.STAT_FLAG = 'C')
GROUP BY
S.NAME,
S.RRN,
RTRIM (LTRIM (S.STREET_NBR) |) ' ' ||
RTRIM (SUBSTR (S.STREET, 33, 2)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 1, 28)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 29, 4)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 35, 2))) | ' ' ||
NVL2 (S.UNIT_NBR, ' #',' ') | ' ' ||
LTRIM (S.UNIT_NBR),
S.CITY_NAME,
S.STPV_CODE,
RTRIM (S.ZIP_CODE) |
'-'||
S.ZIP_PLUS4,
S.HOME_PHONE,
S.ACCT_NBR,
TO_CHAR (S.EXPR_DATE, 'MMDDYY'),
TO_CHAR ((P.EFF_DATE-1), 'MMDDYY').
TO_CHAR (SYSDATE, 'MMDDYY'),
(-1 * (S.BALANCE_AMT + (S.BALANCE_AMT*.06) + S.DLVF_AMT) * 100),
S.STAT_FLAG
ORDER BY 10;
-The application 2
Select
THE DISCUS THROW. TRN_STP_SUN. SUB_RRN
Of
THE DISCUS THROW. TRN_STP_SUN,
(select SUB_RRN, min (seq_ctr) MINSEQ, SRCE_CODE1 of DISCUS. SUB_RRN TRN_STP_SUN, SRCE_CODE1 group) MIN_ROWS
where
THE DISCUS THROW. TRN_STP_SUN. MIN_ROWS = SUB_RRN. SUB_RRN
And DISCUS. TRN_STP_SUN. MIN_ROWS = SRCE_CODE1. SRCE_CODE1
And DISCUS. TRN_STP_SUN. MIN_ROWS = SEQ_CTR. MINSEQ
And DISCUS. TRN_STP_SUN. SRCE_CODE1 IN ('FREE', 'ALTP","CANADA","E","DENY","DOOR")
And TRUNC (DISCUS. TRN_STP_SUN. EFF_DATE) BETWEEN TRUNC (SYSDATE)-460 AND TRUNC (SYSDATE)-0
And DISCUS. TRN_STP_SUN. TYPE = S"
Request 3 (Broken query)
SELECT DISTINCT
S.NAME,
S.RRN,
RTRIM (LTRIM (S.STREET_NBR) |) ' ' ||
RTRIM (SUBSTR (S.STREET, 33, 2)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 1, 28)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 29, 4)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 35, 2))) | ' ' ||
NVL2 (S.UNIT_NBR, ' #',' ') | ' ' ||
ADDRESS LTRIM (S.UNIT_NBR),
CITY OF S.CITY_NAME,
S.STPV_CODE STATE,
RTRIM (S.ZIP_CODE) |
'-'||
S.ZIP_PLUS4 ZIP,
S.HOME_PHONE,
S.ACCT_NBR,
TO_CHAR (S.EXPR_DATE, 'MMDDYY') START_DATE,
TO_CHAR ((P.EFF_DATE-1), 'MMDDYY') END_DATE.
TO_CHAR(SYSDATE,'MMDDYY') FILE_DATE,
ROUND ((-1 * (S.BALANCE_AMT + (S.BALANCE_AMT*.06) + S.DLVF_AMT)) * 100) TO BALANCE.
S.STAT_FLAG,
MIN (P.SEQ_CTR) SEQ_CTR
Of
THE DISCUS THROW. SUB_SUN S,.
THE DISCUS THROW. TRN_STP_SUN P,.
THE DISCUS THROW. TRN_MEM_SUN M.
(SELECT
SUB_RRN,
TRAN_CODE,
EFF_DATE,
MIN (SEQ_CTR)
Of
THE DISCUS THROW. TRN_DLR_SUN
WHERE
TRAN_CODE = 'BILL' AND
EFF_DATE > = TRUNC (SYSDATE)-65
GROUP BY
SUB_RRN,
TRAN_CODE,
EFF_DATE,
D SEQ_CTR)
WHERE
S.RRN = P.SUB_RRN AND
S.RRN = M.SUB_RRN AND
S.RRN = D.SUB_RRN (+) AND
TRIM (P.PAPR_CODE) = "SS" AND
S.BILL_CODE NOT IN ("PRTY", "EZCC', 'EMPB', 'CTCE', 'NSPC", "NYET", "NIEF", "SAMP", "ALTP", "COMP", "CMHC", "MAIL") AND
TRIM (S.STAT_FLAG) = 'F' AND
P.TYPE = 'P' AND
* S.RRN NOT IN (select + _ *)
DISCUS. TRN_STP_SUN. SUB_RRN_ *.
de_ *
DISCUS. TRN_STP_SUN,_ *.
+ (select SUBNRNS, min (seq_ctr) MINSEQ, SRCE_CODE1 de DISCUS.) SUB_RRN TRN_STP_SUN, SRCE_CODE1 group) MIN_ROWS + _ *.
où_ *
DISCUS. TRN_STP_SUN. MIN_ROWS = SUB_RRN. SUB_RRN_ *.
And DISCUS. TRN_STP_SUN. MIN_ROWS = SRCE_CODE1. SRCE_CODE1_ *.
And DISCUS. TRN_STP_SUN. MIN_ROWS = SEQ_CTR. MINSEQ_ *.
And DISCUS. TRN_STP_SUN. SRCE_CODE1 IN ('FREE', 'ALTP","CANADA","E","DENY","DOOR")_ *.
And DISCUS. TRN_STP_SUN. TYPE = the of '_ *.
and discus.trn_stp_sun.sub_rrn is not null) *AND _
P.SPRS_CODE IN ('NOPY","CHMD","SCOUT","TIME") AND
TRUNC (P.EFF_DATE) BETWEEN TRUNC (SYSDATE)-35 AND TRUNC (SYSDATE)-29 AND
S.NAME_FLAG! = 'B' AND
(S.BALANCE_AMT + (S.BALANCE_AMT*.06) + (S.DLVF_AMT)) <-6.99 AND
M.CODE! = 'DISP' AND
NOT EXIST
(SELECT
Q.HOME_PHONE
Of
THE DISCUS THROW. SUB_SUN Q
WHERE
S.HOME_PHONE = Q.HOME_PHONE AND
Q.SUBT_CODE IN ('HARD DRIVES', 'HDLV') AND
Q.STAT_FLAG = 'C')
GROUP BY
S.NAME,
S.RRN,
RTRIM (LTRIM (S.STREET_NBR) |) ' ' ||
RTRIM (SUBSTR (S.STREET, 33, 2)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 1, 28)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 29, 4)) | ' ' ||
RTRIM (SUBSTR (S.STREET, 35, 2))) | ' ' ||
NVL2 (S.UNIT_NBR, ' #',' ') | ' ' ||
LTRIM (S.UNIT_NBR),
S.CITY_NAME,
S.STPV_CODE,
RTRIM (S.ZIP_CODE) |
'-'||
S.ZIP_PLUS4,
S.HOME_PHONE,
S.ACCT_NBR,
TO_CHAR (S.EXPR_DATE, 'MMDDYY'),
TO_CHAR ((P.EFF_DATE-1), 'MMDDYY').
TO_CHAR (SYSDATE, 'MMDDYY'),
(-1 * (S.BALANCE_AMT + (S.BALANCE_AMT*.06) + S.DLVF_AMT) * 100),
S.STAT_FLAG,
P.SEQ_CTR
ORDER BY 10;Yes, your problem is that the not exists clause. Try:
SELECT DISTINCT S.NAME, S.RRN, RTRIM(LTRIM(S.STREET_NBR) || ' ' || RTRIM(SUBSTR(S.STREET,33,2)) || ' ' || RTRIM(SUBSTR(S.STREET,1,28)) || ' ' || RTRIM(SUBSTR(S.STREET,29,4)) || ' ' || RTRIM(SUBSTR(S.STREET,35,2))) || ' ' || NVL2(S.UNIT_NBR, '#', ' ') || ' ' || LTRIM(S.UNIT_NBR) ADDRESS, S.CITY_NAME CITY, S.STPV_CODE STATE, RTRIM(S.ZIP_CODE) || '-'|| S.ZIP_PLUS4 ZIP, S.HOME_PHONE, S.ACCT_NBR, TO_CHAR(S.EXPR_DATE,'MMDDYY') START_DATE, TO_CHAR((P.EFF_DATE-1),'MMDDYY') END_DATE, TO_CHAR(SYSDATE,'MMDDYY') FILE_DATE, ROUND((-1*(S.BALANCE_AMT + (S.BALANCE_AMT*.06) + S.DLVF_AMT))*100) BALANCE, S.STAT_FLAG, MIN(P.SEQ_CTR) SEQ_CTR FROM DISCUS.SUB_SUN S, DISCUS.TRN_STP_SUN P, DISCUS.TRN_MEM_SUN M, (SELECT SUB_RRN, TRAN_CODE, EFF_DATE, MIN(SEQ_CTR) FROM DISCUS.TRN_DLR_SUN WHERE TRAN_CODE = 'BILL' AND EFF_DATE >= TRUNC(SYSDATE)-65 GROUP BY SUB_RRN, TRAN_CODE, EFF_DATE, SEQ_CTR)D, (select distinct DISCUS.TRN_STP_SUN.SUB_RRN from DISCUS.TRN_STP_SUN, (select SUB_RRN, min(seq_ctr) MINSEQ, SRCE_CODE1 from DISCUS.TRN_STP_SUN group by SUB_RRN, SRCE_CODE1) MIN_ROWS where DISCUS.TRN_STP_SUN.SUB_RRN = MIN_ROWS.SUB_RRN And DISCUS.TRN_STP_SUN.SRCE_CODE1 = MIN_ROWS.SRCE_CODE1 And DISCUS.TRN_STP_SUN.SEQ_CTR = MIN_ROWS.MINSEQ And DISCUS.TRN_STP_SUN.SRCE_CODE1 IN ('FREE','ALTP','ELSN','EMPL','NIE','DOOR') And DISCUS.TRN_STP_SUN.TYPE = 'S' And DISCUS.TRN_STP_SUN.SUB_RRN is not null) Z WHERE S.RRN = P.SUB_RRN AND S.RRN = M.SUB_RRN AND S.RRN = D.SUB_RRN(+) AND TRIM(P.PAPR_CODE) = 'SS' AND S.BILL_CODE NOT IN ('PRTY','EZCC','EMPB','EMPP','NSPC','NIET','NIEF','SAMP','ALTP','COMP','SCHL','MAIL') AND TRIM(S.STAT_FLAG) = 'F' AND P.TYPE = 'P' AND P.SPRS_CODE IN ('NOPY','CHMD','OTHR','TIME') AND TRUNC(P.EFF_DATE) BETWEEN TRUNC(SYSDATE)-35 AND TRUNC(SYSDATE)-29 AND S.NAME_FLAG != 'B' AND (S.BALANCE_AMT + (S.BALANCE_AMT*.06) + (S.DLVF_AMT)) < -6.99 AND M.CODE != 'DISP' and NOT EXISTS (SELECT Q.HOME_PHONE FROM DISCUS.SUB_SUN Q WHERE S.HOME_PHONE = Q.HOME_PHONE AND Q.SUBT_CODE IN ('HDDS','HDLV') AND Q.STAT_FLAG = 'C') AND Z.SUB_RRN (+) = S.RRN AND Z.SUB_RRN is null GROUP BY S.NAME, S.RRN, RTRIM(LTRIM(S.STREET_NBR) || ' ' || RTRIM(SUBSTR(S.STREET,33,2)) || ' ' || RTRIM(SUBSTR(S.STREET,1,28)) || ' ' || RTRIM(SUBSTR(S.STREET,29,4)) || ' ' || RTRIM(SUBSTR(S.STREET,35,2))) || ' ' || NVL2(S.UNIT_NBR, '#', ' ') || ' ' || LTRIM(S.UNIT_NBR), S.CITY_NAME, S.STPV_CODE, RTRIM(S.ZIP_CODE) || '-'|| S.ZIP_PLUS4, S.HOME_PHONE, S.ACCT_NBR, TO_CHAR(S.EXPR_DATE,'MMDDYY'), TO_CHAR((P.EFF_DATE-1),'MMDDYY'), TO_CHAR(SYSDATE,'MMDDYY'), (-1*(S.BALANCE_AMT + (S.BALANCE_AMT*.06) + S.DLVF_AMT)*100), S.STAT_FLAG, P.SEQ_CTR ORDER BY 10;
-
can we run request less than 20-bit on a 64 bit os?
I want to run applications on 64-bit operating system, that are less than 20 bits
Hello
Compatibility for different applications depending on Windows XP. However, you can try running that compatibility programs discover a check if they work.
Click on the link provided below for more information on running a program in compatibility mode.
-
Query is running slowly (30 sec) first, then quickly - how to find out why?
Hi all
First of all, a warning: we are a company of rapidly growing software which provides a SaaS-like solution and is hosting an Oracle database for our own software running at client locations. I'm still not a DBA, but I've been learning for a while now and will follow appropriate courses, next year. This problem becomes urgent enough, however.
We have an Oracle 12 c (12.1.0.1.7) running on a pretty Beefy hardware (card SSD 8 cores, 72GO,) and it works fine. One of our applications raise queries that run slowly very often, but when I run the same query through Toad, it is very fast again. Sometimes I can make the same query to be slow again by changing settings, adding values to an in(), etc., but not always. By not being is not in a position to know WHY the query is slow, I can not as a solution. We have been struggling with this problem for some time (more than a year, I think) and had the same problem when you still run Oracle 11.
Some more bits of information that might be relevant:
-This user defines cursor_sharing for force, per my request (the software itself does not lie)
-J' put optimizer_index_caching at 25, because I know the DB all be in memory.
-J' put optimizer_index_cost_adj at 50, because I saw full table scan too for my taste. The two parameters when it is while the queries were not already productive.
-Memory: memory_target = 40 GB, db_cache_size = 5.5 GB, pga_aggregate_target = 8 GB sga_target = 30 GB
-Optimizer_dynamic_sampling is the default, 2.
-J' saw a few query plans have a note, something like "Explain plan was made with the statistics from previous executions. All do not have this, however.
-J' saw some explain plans in which the actual recordings differ a large amount of the expected records, planned somethings was 1, real was 4 billion...
-We actually had to add / * ordered * / for some queries to speed up execution. It's been a few other issues have better results (20 sec every time! to 200 ms), but worse when Oracle has finally found the execution plan (40ms).
-Many queries seemed to start with arrays of harm to our taste.
-A copy of the database, running locally, also had some problems with queries - the plan of the explain command took 2 seconds, the query itself only a few Ms. the same database of course does not receive any insert/update statements.
It may be important to note that this scheme receives a lot of updates and inserts, so I thought that it could screw up the statistics?
As I wrote, we have been struggling with this problem for a long, long time. We have made changes to hardware, the parameters of the Oracle, the client software, everywhere, but are no closer to a permanent solution. Any help would be greatly appreciated!
Kind regards
Jelmer
Post edited by: optimizer_cursor_caching 1449188-> optimizer_index_caching
1449188 wrote:
Time for a summary:
-We switched off forced cursor sharing. This reduces overall Oracle CPU usage a bit.
-We removed the / + SORTED * / in queries with a theatrical performance
-optimizer_dynamic_sampling was fixed at 11, but _optimizer_use_feedback is always enabled
-All the tables and indexes were analyzed, I created statistics expanded on the task, address, person
Many queries work MUCH better, another big thank you to all who have helped me so far.
...
In particular the line 25 confuses me. Always this BITMAP AND even that crazy E-lines / difference A-lines. I'm sure that's the only reason for the poor performance of this query...
I think you have a mixture of different effects here, which doesn't makes it really simple to understand exactly what is happening. To some extent this seems to be caused by the new features added in 11g and 12 c.
1. looking at the trace of the files provided above, there seems to be some problem with dynamic sampling overload (DS). This seems to be one of the reasons why you have this "first slow exec", the second fast exec, in this case without a change of regime. In this trace file, it takes 5 seconds or more to run all these queries recursive dynamic sampling as part of the generation of the plan, and there are two DS queries that contribute significantly to that time (more than 3 seconds for these two DS queries).
In order to have OPTIMIZER_DYNAMIC_SAMPLING 11 value causes these additional queries. The advantage of this setting is that you get good enough (join) estimates. Of course, it is difficult to judge how much you make this setting and how you lose the overhead of generating plan. New DS queries make use of the RESULT_CACHE have, in principle, reassessment of the same DS queries should come from the RESULT_CACHE. However, if your RESULT_CACHE is too small to contain all of the query results (although these result sets is usually very small) you can sometimes get slowdowns in generational terms if these queries need to be run instead of pull results from the cache.
2. the function of vibration of statistics of course is involved and sometimes leads to a re-optimizing. Once again, this could then lead to the problem mentioned in point 1., if DS requests takes a long time to generate the plan.
So these two functions together could lead to some difficult to predict behavior (slow first => possibly caused by DS, second time slow => caused by Feedback: statistics, leading again to DS, third etc. quick time.). It may also explain why you see 'first exec' slow, second fast exec, if re-optimizing na not take too much time and lead to a better execution plan.
3. the special regard that seems to be the wide track as part of an internal source of lines join nested loop - and in this case, the estimates are * iterative *, so be careful when comparing E-lines (iteratively) with A-lines (cumulative across all iterations). The index used functionality combine to combine two indexes TASK_IDX1 and TASK_IDX2 suggest that it would be beneficial to add PERSON_ID to TASK_IDX1 and maybe get rid of TASK_IDX2 - but it might be appropriate to other queries, which I can't really judge. You can then check if adding more attributes to TASK_IDX1 it would make even more selective about the level of the index, as most of the lines for this particular query is filtered on the WORK table, so adding TASK level. FIXED, TASK. CLOSED and/or TASK. PLAN_START / PLAN_END it would make an even more effective operation. But adding PERSON_ID should solve this particular problem.
4. the 'quick' this query (mentioned somewhere at the beginning) variation has no merge view inline (SELECT HELP... GROUP BY...), then you can try this by adding a NO_MERGE hint to the inline query (SELECT / * + NO_MERGE * / AID...), just to see if that gives you several times the plan 'rapid '. I still think that the index change described might be the best choice.
5 SQL Directives of the Plan have been mentioned a couple of times, and I think that it is not quite clear to you what they are. They are not "advice", but are a new feature added to 12 c where Oracle persists some information on bad estimates and then evaluates these SQL Plan plan generation for dynamic additional sample queries and the production of statistics to create additional guidance extended statistics. I don't have enough experience with this new feature and therefore cannot judge how they play a role here. You can ask DBA_SQL_PLAN_DIR_OBJECTS and DBA_SQL_PLAN_DIRECTIVES to see if there are tickets for your particular objects in question.
Randolf
-
Example of
Currently, when the user enters the page interactive report runs (unless the user hitting ' go') and - does no data found because one "parameterized" field is required and the sql is not set to NULL values.
I'm looking for a way to not run a query at all -until the user hits go for the first time on the page - each time that they re - enter the page in the same session, it would be OK to auto submit the query.
I believe that I can install a hidden item and check on my interactive report E1 not null. Then create a 'calculation' on 'after bid"that would set this value to a value - say 1.
I can't seem to be able to get this to work however.
In my interactive report - I wonder what 'type condition' should I use. Any thoughts would be greatly appreciated.
You have two regions, research and order Type. You have items in the two regions. However, I think you are talking about the area "Search" when you say 2 parameters.
If you want to just display IR when the user clicks on 'Go' or click on 'Go' earlier in the same session, then I suggest,
- Create a new item of the hidden page, P6_SHOW_IR
- Create page process that runs when the user clicks on the button 'Go '. Here to update the value of P6_SHOW_IR 'Y '.
- Create a branch that connects to the same page with "State of Session saving" checked (connections conditional, when click on the button "Go")
- Set "Conditions" for the region of infrared, so it displays only when the value of the P6_SHOW_IR element is Y
Kind regards
Hari
-
I'm looking for only column compare to my same target table as a table source.
My query:
Select case when column_name_s is null and column_name_t is not null
then "alter table GRADE_CONVERSION drop | column_name_t | ';'
When column_name_s is not null and column_name_t is null
then "alter table GRADE_CONVERSION add | column_name_s | ' ' || data_type_s | « ; »
else 'alter table modify GRADE_CONVERSION | column_name_t | ' ' || data_type_t | « ; »
alterations of the end
from (select s.column_name column_name_s, t.column_name column_name_t,
s.data_type data_type_s, t.data_type data_type_t
(select column_name, column_id, data_type
of all_tab_cols@database
where owner = 'erhan.
and table_name = "GRADE_CONVERSION."
+ 1
full outer join
(select column_name, column_id, data_type
of all_tab_cols@database
where owner = 'sarigul.
and table_name = "GRADE_CONVERSION."
+ 6
on s.column_name = t.column_name
)
Tables:
Target table: table GRADE_CONVERSION in sarigul@database
LETTER_GRADE VARCHAR2 (2) GRADE_POINT NUMBER (3.2) MAX_GRADE NUMBER (3) MIN_GRADE NUMBER (3) Table source: Table GRADE_CONVERSION in erhan@database
LETTER_GRADE VARCHAR2 (2) GRADE_POINT NUMBER (3.2) MAX_GRADE NUMBER (3) MIN_GRADE NUMBER (3) CREATED_BY VARCHAR2 (30) CREATED_DATE DATE MODIFIED_BY VARCHAR2 (30) MODIFIED_DATE DATE want to see output that is similar to this * (please ignore the names of column here it's just a clear example :))
ALTER table Target_table change BOOK_ID Varchar2 (4);
ALTER table Target_table I addSBN_10 Varchar2(13), null;
ALTER table drop TITLE Target_table;
Erhan_toronto wrote:
1.I used src.nullable src_nullable and tgt.nullable tgt_nullable but only show Yes as below: but want to see the result as not null or null
ALTER table TEST_TARGET change the NUMBER of MAX_GRADE (3, 2) Yes
Ok. So it's all about the Yes and the no decoding to Default Null or Not Null, isn't it?
So, to test, change one of the table of sample for NOT NULL columns in the source table, and then run the following query:
with src as ( select src.table_name src_table_name, src.column_name src_col_name, src.data_type src_data_type, src.data_length src_data_len, src.data_precision src_data_precision, src.data_scale src_data_scale, src.nullable src_nullable from user_tab_columns src where table_name = 'TEST_SOURCE' ), tgt as ( select tgt.table_name tgt_table_name, tgt.column_name tgt_col_name, tgt.data_type tgt_data_type, tgt.data_length tgt_data_len, tgt.data_precision tgt_data_precision, tgt.data_scale tgt_data_scale, tgt.nullable tgt_nullable from user_tab_columns tgt where table_name = 'TEST_TARGET' ), col_details as ( select src.src_table_name, nvl(tgt.tgt_table_name, first_value(tgt_table_name) over(order by tgt_table_name nulls last)) tgt_table_name, src.src_col_name, src.src_data_type, src.src_data_len, src.src_data_precision, src.src_data_scale, src.src_nullable, tgt.tgt_col_name, tgt.tgt_data_type, tgt.tgt_data_len, tgt.tgt_data_precision, tgt.tgt_data_scale, tgt.tgt_nullable from src left outer join tgt on ( src.src_col_name = tgt.tgt_col_name ) ) select * from ( select case when tgt_data_type != src_data_type or tgt_data_len != src_data_len or tgt_data_precision != src_data_precision or tgt_data_scale != src_data_scale or src_nullable != tgt_nullable then 'alter table ' || tgt_table_name || ' modify ' || tgt_col_name || ' ' || src_data_type || ' (' || case when src_data_type in ('DATE') then null else case when src_data_type in ('VARCHAR', 'VARCHAR2') then nvl(to_char(src_data_len), ' ') || ') ' else decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')') end end || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL') when tgt_col_name is null then 'alter table ' || tgt_table_name || ' add ' || src_col_name || ' ' || src_data_type || case when src_data_type in ('DATE') then null else case when src_data_type in ('VARCHAR', 'VARCHAR2') then nvl(to_char(src_data_len), ' ') || ') ' else decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')') end end || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL') end alter_statement from col_details ) where alter_statement is not null;
Erhan_toronto wrote:
2. when I run below under user sarigul and erhan I get the result as OWNER, TABLE_NAME, COLUMN_NAME DATA_TYPE... I have a link between two users. They have access to two tables.
- Select * from all_tab_columns
where owner = 'erhan' and table_name = "TEST_SOURCE."
- Select * from all_tab_columns
where owner = 'sarigul' and table_name = "TEST_TARGET."
Alright. This means that you both users are on the same database. Only change, you will have to do in the above query is so change user_tab_columns to all_tab_columns and add the OWNER predicate respectively with the clause.
-
The query will run Oracle 10 g?
Hello
This is the structure of the table emp and dept. There is a request on this basis, please let me know if this request is going to work?
EMP table
=========
EMPID NUMBER PRIMARY KEY,
NAME
ADDRESS
DEPT table
==========
DEPTNO NUMBER,
DEPTNAME
Select * from emp where empid in (select empid from dept where dept_no = 10);Nordik wrote:
HelloThis is the structure of the table emp and dept. There is a request on this basis, please let me know if this request is going to work?
EMP table
=========
EMPID NUMBER PRIMARY KEY,
NAME
ADDRESSDEPT table
==========
DEPTNO NUMBER,
DEPTNAMESelect * from emp where empid in (select empid from dept where dept_no = 10);
Yes, it will run.
Oracle must first check if the EMPID column exists in the DEPT table.
If it's not, then it checks for columns in the outer query.And in this case, because you do not Alias of Table. An Alias has been used, the column would have been checked only in the table with an alias.
In addition, you will lose everything except to check the query on a database, would you?
Pretty easy to verify this, right?
create table test_table (col1 number, col2 varchar2(5)); create table test_table2 (col1 number); select * from test_table t1 where col2 in (select col2 from test_table2 t2 where t1.col1 = t2.col1); no rows returned
-
Query by running the Diffrence of STATS$ EVENT_HISTOGRAM
I am tiring to perform an analysis on STATS$ EVENT_HISTOGRAM (created in PERFSTAT).
I would like to end up with a result like this;
The rules are (I know so far):SNAP_ID SNAP_TIME DB_RESTART WAIT_COUNT_LE_7MS WAIT_COUNT_GT_7MS TOTAL_WAIT_COUNT WAIT_COUNT_PERCENT_LE_7MS WAIT_COUNT_PERCENT_GT_7MS 397 2/9/2012 2:02:39 PM NO 3,311 16,261 19,572 16.92 83.08 398 2/9/2012 2:35:03 PM NO 10,040 11,499 21,539 46.61 53.39 399 2/9/2012 5:02:22 PM YES 11,137 113,916 225,053 49.38 50.62 400 2/9/2012 5:32:21 PM NO 5,880 5,047 10,927 53.81 46.19 401 2/9/2012 6:02:21 PM NO 1,342 3,004 4,346 30.88 69.12
1. all values correspond to the difference of the previous SNAP_ID
2. the first SNAP_ID has no precedential value, so it will not appear in the result set. In our case, it was SNAP_ID 396.
3. when the STATS$ SNAPSHOT. STARTUP_TIME the row changes previous this indicates a DB_RESTART = YES.
4. when DB_RESTART = YES do not subtract the values of previous SNAP_ID.
I'm on Oracle 11.1.0.7
Create the table EVENT_HISTOGRAM STATS$:
Load my data in the table EVENT_HISTOGRAM STATS$:CREATE TABLE STATS$EVENT_HISTOGRAM ( SNAP_ID NUMBER, DBID NUMBER, INSTANCE_NUMBER NUMBER, EVENT_ID NUMBER, WAIT_TIME_MILLI NUMBER, WAIT_COUNT NUMBER );
Create STATS$ snapshot table:Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI,WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 1,47088592); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 2, 7397910); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 4, 1049509); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 8, 2384662); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 16, 12446589); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 32, 6698196); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 64, 934431); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 128, 655758); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 256, 213053); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 512, 73814); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 1024, 6088); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 2048, 1825); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 4096, 2169); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 8192, 3122); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 16384, 4144); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 32768, 330); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 65536, 662); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 131072, 9); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 262144, 28); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (396, 2359907137, 1, 2652584166, 524288, 22); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 1, 47091161); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 2, 7398497); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 4, 1049664); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 8, 2386574); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 16, 12454531); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 32, 6701651); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 64, 934831); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 128, 656657); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 256, 213223); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 512, 74218); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 1024, 6167); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 2048, 1869); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 4096, 2237); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 8192, 3317); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 16384, 4779); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 32768, 358); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 65536, 663); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 131072, 12); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 262144, 47); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (397, 2359907137, 1, 2652584166, 524288, 29); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 1, 47100463); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 2, 7399116); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 4, 1049783); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 8, 2387726); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 16, 12459548); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 32, 6704135); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 64, 935351); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 128, 657496); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 256, 213525); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 512, 74515); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 1024, 6224); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 2048, 1898); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 4096, 2323); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 8192, 3503); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 16384, 5229); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 32768, 381); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 65536, 671); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 131072, 20); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 262144, 68); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (398, 2359907137, 1, 2652584166, 524288, 49); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 1, 86466); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 2, 20937); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 4, 3734); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 8, 11128); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 16, 58220); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 32, 33902); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 64, 5707); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 128, 3308); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 256, 1149); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 512, 413); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 1024, 40); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 2048, 25); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 4096, 12); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 8192, 7); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 16384, 4); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 32768, 0); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (399, 2359907137, 1, 2652584166, 65536, 1); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 1, 88335); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 2, 24658); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 4, 4024); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 8, 11678); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 16, 61227); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 32, 35252); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 64, 5821); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 128, 3316); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 256, 1158); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 512, 421); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 1024, 41); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 2048, 25); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 4096, 12); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 8192, 7); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 16384, 4); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 32768, 0); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (400, 2359907137, 1, 2652584166, 65536, 1); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 1, 89498); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 2, 24811); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 4, 4050); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 8, 11919); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 16, 62776); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 32, 36157); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 64, 5993); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 128, 3424); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 256, 1181); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 512, 427); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 1024, 41); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 2048, 25); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 4096, 12); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 8192, 7); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 16384, 4); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 32768, 0); Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT) Values (401, 2359907137, 1, 2652584166, 65536, 1); COMMIT;
Load my data in the snapshot table $ STATS:CREATE TABLE STATS$SNAPSHOT ( SNAP_ID NUMBER, DBID NUMBER, INSTANCE_NUMBER NUMBER, SNAP_TIME DATE, STARTUP_TIME DATE, SESSION_ID NUMBER, SERIAL# NUMBER, SNAP_LEVEL NUMBER, UCOMMENT VARCHAR2(160 BYTE), EXECUTIONS_TH NUMBER, PARSE_CALLS_TH NUMBER, DISK_READS_TH NUMBER, BUFFER_GETS_TH NUMBER, SHARABLE_MEM_TH NUMBER, VERSION_COUNT_TH NUMBER, SEG_PHY_READS_TH NUMBER, SEG_LOG_READS_TH NUMBER, SEG_BUFF_BUSY_TH NUMBER, SEG_ROWLOCK_W_TH NUMBER, SEG_ITL_WAITS_TH NUMBER, SEG_CR_BKS_RC_TH NUMBER, SEG_CU_BKS_RC_TH NUMBER, SEG_CR_BKS_SD_TH NUMBER, SEG_CU_BKS_SD_TH NUMBER, SNAPSHOT_EXEC_TIME_S NUMBER, ALL_INIT VARCHAR2(5 BYTE), BASELINE VARCHAR2(1 BYTE) );
Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (396, 2359907137, 1, TO_DATE('02/09/2012 13:32:26', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 21.92, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (397, 2359907137, 1, TO_DATE('02/09/2012 14:02:39', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 70.49, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (398, 2359907137, 1, TO_DATE('02/09/2012 14:35:03', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 14.28, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (399, 2359907137, 1, TO_DATE('02/09/2012 17:02:22', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 15.92, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (400, 2359907137, 1, TO_DATE('02/09/2012 17:32:21', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 2.77, 'FALSE'); Insert into STATS$SNAPSHOT (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME, SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH, DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH, SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH, SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT) Values (401, 2359907137, 1, TO_DATE('02/09/2012 18:02:21', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'), 0, 0, 7, 100, 1000, 1000, 10000, 1048576, 20, 1000, 10000, 100, 100, 100, 1000, 1000, 1.72, 'FALSE'); COMMIT;
Hello
Sky13 wrote:
OK I got it to work,I'm glad that you guessed it work. When I tried to run your query later, I got an error. On line 7, I think you meant
when lag(SS.STARTUP_TIME) over (order by SS.SNAP_ID) != SS.STARTUP_TIME then 'YES'
This site do not display the <>inequality operator. When you post here, always use the other, equivalent more!, =.
When I fix it, I don't get 'no rows selected '.but it's ugly! Any ideas on simplification it?
It's a little shorter, but still pretty ugly:
WITH got_wait_time_grp AS ( SELECT snap_id , wait_count , CASE WHEN wait_time_milli <= 7 THEN '<= 7' ELSE '> 7' END AS wait_time_grp FROM stats$event_histogram WHERE event_id = 2652584166 ) , grouped_data AS ( SELECT ss.snap_id , ss.snap_time , eh.wait_time_grp , CASE WHEN ss.startup_time != LAG (ss.startup_time) OVER ( PARTITION BY eh.wait_time_grp ORDER BY ss.snap_id ) THEN 'YES' ELSE 'NO' END AS db_restart , SUM (eh.wait_count) - LAG ( SUM (eh.wait_count) , 1 , 0 ) OVER ( PARTITION BY ss.startup_time , eh.wait_time_grp ORDER BY ss.snap_id ) AS wait_dif , DENSE_RANK () OVER (ORDER BY ss.snap_id) AS dr FROM stats$snapshot ss , got_wait_time_grp eh WHERE ss.snap_id = eh.snap_id AND ss.snap_id BETWEEN 396 AND 401 GROUP BY GROUPING SETS ( (ss.snap_id, ss.snap_time, ss.startup_time, eh.wait_time_grp) , (ss.snap_id, ss.snap_time, ss.startup_time) ) ) SELECT snap_id, snap_time, db_restart , MIN (CASE WHEN wait_time_grp = '<= 7' THEN wait_dif END) AS wait_count_le_7ms , MIN (CASE WHEN wait_time_grp = '> 7' THEN wait_dif END) AS wait_count_gt_7ms , MIN (CASE WHEN wait_time_grp IS NULL THEN wait_dif END) AS total_wait_count , MIN (CASE WHEN wait_time_grp = '<= 7' THEN wait_dif END) * 100 / MIN (CASE WHEN wait_time_grp IS NULL THEN wait_dif END) AS wait_count_percent_le_7ms , MIN (CASE WHEN wait_time_grp = '> 7' THEN wait_dif END) * 100 / MIN (CASE WHEN wait_time_grp IS NULL THEN wait_dif END) AS wait_count_percent_gt_7ms FROM grouped_data WHERE dr > 1 GROUP BY snap_id, snap_time, db_restart ORDER BY snap_id ;
Output:
` WAIT_ WAIT_ WAIT_ WAIT_ COUNT_ COUNT_ DB_ COUNT_ COUNT_ TOTAL_ PERCENT PERCENT SNAP RE LE_ GT_ WAIT_ _LE_ _GT_ _ID SNAP_TIME START 7MS 7MS COUNT 7MS 7MS ---- ------------------- ----- ------- ------- ------- ------- ------- 397 2/9/2012 2:02:39 PM NO 3311 16261 19572 16.92 83.08 398 2/9/2012 2:35:03 PM NO 10040 11499 21539 46.61 53.39 399 2/9/2012 5:02:22 PM YES 111137 113916 225053 49.38 50.62 400 2/9/2012 5:32:21 PM NO 5880 5047 10927 53.81 46.19 401 2/9/2012 6:02:21 PM NO 1342 3004 4346 30.88 69.12
-
AF:query re - run SQL programmatically
On a page, I use the af: query that is contrary to a VO in the comic book. The DB is updated outside the ADF BC, then the cache gets stale. So, I want to rerun the query programmatically with the search parameters the user used on the latest research.
I tried to set the refresh of the attributes on the ImplicitViewCriteriaQuery or the iterator. This does not help, since the documentation says that a discount don't lead necessary to the execution of SQL. An explicit call to run on the ViewIterator did not help either. Well, the iterator is the search criteria?
In fact I want to simulate a click on the button Search, until the page is rendered. Any ideas?Just clear the cache of VO and refresh the user interface of the PPR Panel. The re VO - runs the last query automatically. Use this method:
vo.clearCache();
-
Property of AutoSubmit causing the query to run.
Hello Gurujis!
10.1.3.1 with JSF + ADF + EJB 3.0 using JDev stack.
I have an inputTextBox whose property Autosubmit (due to a ValueChangeListener) is originally a MethodIterator for a request to fire and run a query each time the ValueChangeListener is triggered.
When I try setting the RefreshCondition of the MethodIterator ${! adfFacesContext.postback}, my query no longer works when I click on the button that you run the query.
Is there a way to put the RefreshCondition to something as "whenever a specific button is clicked" or "not by activating a ValueChangeListener?
I seem to have a fundamental misunderstanding of how it works and any help would be greatly appreciated.
Thank youHello
sounds all so weired that you declare so I guess a specific problem of implementation. If you set ${! adfFacesContext.postback} then the method runs only on applications for publication, which is not what brings the button (the button behavior is to use the postbacks).
The simplest thing to try is to set a session attribute using a setActionListener on the button.
in: #{'good'}
in: #{sessionScope.condition}Then the State of refreshment of the action value
#{sessionScope.condition 'good' eq}
However, this might solve the problem but can only fix a failed implementation based on a false assumption
Frank
-
How to know exactly what part of a query is running?
Hi guys,.
I use the following query to see what queries are running
However, it is possible to get a further breakdown of the request? that is to say see what part of the explain plan command is actually done?SELECT a.sid, a.USERNAME, a.STATUS, b.sql_text FROM V$SESSION a INNER JOIN V$SQLAREA b ON a.SQL_ADDRESS= b.ADDRESS;
Thank youWould you explain to a specific SID command.
"accept Vside guest ' SID value enter:"
rowset 132 off veri
Col object_name form a34
operation collar shape a45
Select-lpad(' ',depth+1), rpad (' ', 132,'... |'))
|| operation | » '|| options of | ' '|| decode (depth, 0,' optimizer Mode ='| optimizer,' ') operation.
object_name, cardinality, bytes, cost-, partition_start, partition_stop
v $ sql_plan where hash_value = (select sql_hash_value in the session $ v where sid = & Vside)
order by ID
/ -
SQL Query + long running.
Dear gurus/masters/All,
I beg you all to help me with the setting of the SQL query that takes more time. DB version: 10.2.0.4
Query SQL WHERE condition:
Query execution plan:select column1, column2, ......... FROM SIEBEL.S_ORG_EXT T1, SIEBEL.S_PROD_INT T2, SIEBEL.S_VOD T3, SIEBEL.S_ORG_EXT T4, SIEBEL.S_ORG_EXT T5, SIEBEL.S_ORG_EXT_X T6, SIEBEL.S_PROD_LN T7, SIEBEL.S_ASSET_OM T8, SIEBEL.S_VOD_VER T9, SIEBEL.S_CTLG_CAT T10, SIEBEL.S_CONTACT T11, SIEBEL.S_PARTY T12, SIEBEL.S_PARTY T13, SIEBEL.S_PROD_INT T14, SIEBEL.S_ASSET_BU T15, SIEBEL.S_CTLG_CAT T16, SIEBEL.S_ORG_EXT T17, SIEBEL.S_ORG_EXT T18, SIEBEL.S_ASSET T19, SIEBEL.S_ADDR_PER T20, SIEBEL.S_ORG_EXT T21, SIEBEL.S_ASSET_X T22, SIEBEL.S_ASSET T23 WHERE T16.PAR_CAT_ID = T10.ROW_ID (+) AND T14.CG_PR_CTLG_CAT_ID = T16.ROW_ID (+) AND T3.ROW_ID = T9.VOD_ID AND T14.CFG_MODEL_ID = T3.OBJECT_NUM AND T23.OWNER_CON_ID = T11.ROW_ID (+) AND T23.OWNER_ACCNT_ID = T6.PAR_ROW_ID (+) AND T23.PER_ADDR_ID = T20.ROW_ID (+) AND T23.PROD_ID = T14.ROW_ID AND T23.OWNER_ACCNT_ID = T21.PAR_ROW_ID (+) AND T14.PR_PROD_LN_ID = T7.ROW_ID (+) AND T23.ROOT_ASSET_ID = T19.ROW_ID (+) AND T19.PROD_ID = T2.ROW_ID (+) AND T23.BILL_ACCNT_ID = T18.PAR_ROW_ID (+) AND T23.RTNG_DLR_ID = T1.PAR_ROW_ID (+) AND T23.PREF_SRV_DLR_ID = T17.PAR_ROW_ID (+) AND T23.DLR_ID = T4.PAR_ROW_ID (+) AND T23.ROW_ID = T22.PAR_ROW_ID (+) AND T23.ROW_ID = T8.PAR_ROW_ID (+) AND T23.PR_CON_ID = T12.ROW_ID (+) AND T23.BU_ID = T15.BU_ID (+) AND T23.ROW_ID = T15.ASSET_ID (+) AND T15.BU_ID = T13.ROW_ID (+) AND T15.BU_ID = T5.PAR_ROW_ID (+) AND ((T23.SERIAL_NUM IS NOT NULL AND T23.PAR_ASSET_ID IS NULL OR T23.X_PHONE_NUMBER IS NOT NULL AND T23.PAR_ASSET_ID IS NOT NULL) AND (T9.VER_NUM = :1));
PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 967177145 -------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 54117 | 92M| 4435K (1)| 01:58:43 | | 1 | NESTED LOOPS OUTER | | 54117 | 92M| 4435K (1)| 01:58:43 | | 2 | NESTED LOOPS OUTER | | 54117 | 87M| 4261K (1)| 01:54:04 | | 3 | NESTED LOOPS OUTER | | 54117 | 86M| 4154K (1)| 01:51:13 | | 4 | NESTED LOOPS OUTER | | 54117 | 85M| 4111K (1)| 01:50:03 | | 5 | NESTED LOOPS OUTER | | 54117 | 84M| 3980K (1)| 01:46:33 | | 6 | NESTED LOOPS OUTER | | 54117 | 83M| 3937K (1)| 01:45:24 | | 7 | NESTED LOOPS OUTER | | 54117 | 81M| 3763K (1)| 01:40:44 | | 8 | NESTED LOOPS OUTER | | 54117 | 81M| 3751K (1)| 01:40:25 | | 9 | NESTED LOOPS OUTER | | 54117 | 80M| 3621K (1)| 01:36:57 | | 10 | NESTED LOOPS OUTER | | 54117 | 73M| 3515K (1)| 01:34:07 | | 11 | NESTED LOOPS OUTER | | 54117 | 71M| 3410K (1)| 01:31:18 | | 12 | NESTED LOOPS OUTER | | 54117 | 69M| 3410K (1)| 01:31:18 | | 13 | NESTED LOOPS OUTER | | 54117 | 67M| 3410K (1)| 01:31:18 | | 14 | NESTED LOOPS OUTER | | 54117 | 66M| 3410K (1)| 01:31:18 | | 15 | NESTED LOOPS OUTER | | 54117 | 64M| 3324K (1)| 01:28:59 | | 16 | NESTED LOOPS OUTER | | 54117 | 62M| 3237K (1)| 01:26:40 | | 17 | NESTED LOOPS | | 54117 | 57M| 3106K (1)| 01:23:10 | | 18 | NESTED LOOPS OUTER | | 71 | 43665 | 381 (2)| 00:00:01 | | 19 | NESTED LOOPS OUTER | | 71 | 42316 | 323 (2)| 00:00:01 | | 20 | NESTED LOOPS OUTER | | 71 | 41322 | 322 (2)| 00:00:01 | | 21 | NESTED LOOPS | | 71 | 24708 | 265 (3)| 00:00:01 | | 22 | NESTED LOOPS | | 77 | 2772 | 141 (4)| 00:00:01 | |* 23 | TABLE ACCESS FULL | S_VOD_VER | 75 | 1350 | 72 (7)| 00:00:01 | | 24 | TABLE ACCESS BY INDEX ROWID| S_VOD | 1 | 18 | 1 (0)| 00:00:01 | |* 25 | INDEX UNIQUE SCAN | S_VOD_P1 | 1 | | 1 (0)| 00:00:01 | | 26 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 312 | 2 (0)| 00:00:01 | |* 27 | INDEX RANGE SCAN | S_PROD_INT_F9 | 1 | | 1 (0)| 00:00:01 | | 28 | TABLE ACCESS BY INDEX ROWID | S_PROD_LN | 1 | 234 | 1 (0)| 00:00:01 | |* 29 | INDEX UNIQUE SCAN | S_PROD_LN_P1 | 1 | | 1 (0)| 00:00:01 | | 30 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 1 | 14 | 1 (0)| 00:00:01 | |* 31 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 1 | | 1 (0)| 00:00:01 | | 32 | TABLE ACCESS BY INDEX ROWID | S_CTLG_CAT | 1 | 19 | 1 (0)| 00:00:01 | |* 33 | INDEX UNIQUE SCAN | S_CTLG_CAT_P1 | 1 | | 1 (0)| 00:00:01 | |* 34 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 760 | 375K| 43753 (1)| 00:01:11 | |* 35 | INDEX RANGE SCAN | S_ASSET_U2 | 55873 | | 312 (3)| 00:00:01 | | 36 | TABLE ACCESS BY INDEX ROWID | S_ASSET_OM | 1 | 94 | 2 (0)| 00:00:01 | |* 37 | INDEX RANGE SCAN | S_ASSET_OM_U1 | 1 | | 2 (0)| 00:00:01 | | 38 | TABLE ACCESS BY INDEX ROWID | S_CONTACT | 1 | 39 | 2 (0)| 00:00:01 | |* 39 | INDEX UNIQUE SCAN | S_CONTACT_P1 | 1 | | 1 (0)| 00:00:01 | | 40 | TABLE ACCESS BY INDEX ROWID | S_ADDR_PER | 1 | 29 | 2 (0)| 00:00:01 | |* 41 | INDEX UNIQUE SCAN | S_ADDR_PER_P1 | 1 | | 1 (0)| 00:00:01 | | 42 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 | |* 43 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 44 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 | |* 45 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 46 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 32 | 1 (0)| 00:00:01 | |* 47 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 48 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 36 | 2 (0)| 00:00:01 | |* 49 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 50 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 139 | 2 (0)| 00:00:01 | |* 51 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 52 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT_X | 1 | 16 | 2 (0)| 00:00:01 | |* 53 | INDEX RANGE SCAN | S_ORG_EXT_X_U1 | 1 | | 2 (0)| 00:00:01 | |* 54 | INDEX UNIQUE SCAN | S_PARTY_P1 | 1 | 12 | 1 (0)| 00:00:01 | | 55 | TABLE ACCESS BY INDEX ROWID | S_ASSET_BU | 1 | 34 | 3 (0)| 00:00:01 | |* 56 | INDEX RANGE SCAN | S_ASSET_BU_U1 | 1 | | 2 (0)| 00:00:01 | |* 57 | INDEX UNIQUE SCAN | S_PARTY_P1 | 1 | 12 | 1 (0)| 00:00:01 | | 58 | TABLE ACCESS BY INDEX ROWID | S_ASSET | 1 | 37 | 2 (0)| 00:00:01 | |* 59 | INDEX UNIQUE SCAN | S_ASSET_P1 | 1 | | 2 (0)| 00:00:01 | | 60 | TABLE ACCESS BY INDEX ROWID | S_PROD_INT | 1 | 16 | 1 (0)| 00:00:01 | |* 61 | INDEX UNIQUE SCAN | S_PROD_INT_P1 | 1 | | 1 (0)| 00:00:01 | | 62 | TABLE ACCESS BY INDEX ROWID | S_ORG_EXT | 1 | 14 | 2 (0)| 00:00:01 | |* 63 | INDEX UNIQUE SCAN | S_ORG_EXT_U3 | 1 | | 1 (0)| 00:00:01 | | 64 | TABLE ACCESS BY INDEX ROWID | S_ASSET_X | 1 | 93 | 3 (0)| 00:00:01 | |* 65 | INDEX RANGE SCAN | S_ASSET_X_U1 | 1 | | 2 (0)| 00:00:01 | -------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 23 - filter("T9"."VER_NUM"=TO_NUMBER(:1)) 25 - access("T3"."ROW_ID"="T9"."VOD_ID") 27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM") 29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID"(+)) 31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID"(+)) 33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID"(+)) 34 - filter("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL OR "T23"."X_PHONE_NUMBER" IS NOT NULL AND "T23"."PAR_ASSET_ID" IS NOT NULL) 35 - access("T23"."PROD_ID"="T14"."ROW_ID") 37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID"(+)) 39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID"(+)) 41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID"(+)) 43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID"(+)) 45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID"(+)) 47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID"(+)) 49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID"(+)) 51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID"(+)) 53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID"(+)) 54 - access("T23"."PR_CON_ID"="T12"."ROW_ID"(+)) 56 - access("T23"."ROW_ID"="T15"."ASSET_ID"(+) AND "T23"."BU_ID"="T15"."BU_ID"(+)) 57 - access("T15"."BU_ID"="T13"."ROW_ID"(+)) 59 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID"(+)) 61 - access("T19"."PROD_ID"="T2"."ROW_ID"(+)) 63 - access("T15"."BU_ID"="T5"."PAR_ROW_ID"(+)) 65 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID"(+)) Note ----- - dynamic sampling used for this statement 105 rows selected.
Hello
It is not necessary to display the trace file - everything is clear from the plans that you have posted. The optimizer is the selectivity calculation assuming the absence of correlation between the columns. You can do these calculations that yourself and you see that if the entries are correct and if the hypothesis of lack of correlation is also correct, then the results should be correct, too. Since they are not, it's one of two things: optimizer stats are wrong, or the columns are in fact related.
First of all check the optimizer statistics: i.e. take NUM_ROWS and NUM_NULLS of DBA_TAB_COL_STATISTICS and compare them with the actual rowcounts. If they are correct (in a reasonable error margin), then it means that the columns are correlated, and the optimizer will need additional assistance to obtain right of cardinalities.
Best regards
Nikolai
Maybe you are looking for
-
SSD is MX100 Crucial @256 GB with 1 TB on Athlon X 4 760 K PC HARD drive.
-
Recovery CD wont let me install
My laptop crashed and I get a blank screen. When I go to advanced boot options there is no repair your computer option to select. I ordered the recovery CD and it wont let me install. Any ideas?
-
Presario CQ60-615DX: Presario CQ60-615DX does not illuminate
When it is connected to AC power and the button push, the headlamp three flash twice and nothing happens. If I immediately check the transformer, no juice, but after a few minutes it is good (short circuit and thermofuse?). Should I try once again af
-
HP Deskjet 3050 a J611 won't print envolops
I've never seen a doing the right thing. I changed to another HP printer because I hoped that it would print envolopes but they never do.
-
RESOLVED:See the second post in this thread for the solution (thanks to wiggler forum member) ORIGINAL MESSAGE: [I know I am a "retarded" for even bringing this place, but we'll just go beyond the part and talk about what I really want to know here ]