Optimizing the query - which takes more time
Hi,
Am having a query which was returning the results pretty fast one week back but now the same query takes more time to respond, nothing much changed in the table data, what could be the problem. Am using IN in the where clause, whether that could be an issue? if so what is the best method of rewriting the query.
SELECT RI.RESOURCE_NAME,TR.MSISDN,MAX(TR.ADDRESS1_GOOGLE) KEEP(DENSE_RANK LAST ORDER BY TR.MSG_DATE_INFO) ADDRESS1_GOOGLE,
MAX(TR.TIME_STAMP) MSG_DATE_INFO FROM TRACKING_REPORT TR, RESOURCE_INFO RI
WHERE TR.MSISDN IN ( SELECT MSISDN FROM RESOURCE_INFO WHERE GROUP_ID ='4'
AND COM_ID='12') AND RI.MSISDN = TR.MSISDN
GROUP BY RI.RESOURCE_NAME,TR.MSISDN ORDER BY MSG_DATE_INFO DESC
Hi
i have followed this link http://www.lorentzcenter.nl/awcourse/oracle/server.920/a96533/sqltrace.htm in enabling the trace and found out the following trace output, can you explain the problem here and its remedial action pls.
SELECT RI.RESOURCE_NAME,TR.MSISDN,MAX(TR.ADDRESS1_GOOGLE) KEEP(DENSE_RANK
LAST ORDER BY TR.MSG_DATE_INFO) ADDRESS1_GOOGLE, MAX(TR.TIME_STAMP)
MSG_DATE_INFO
FROM
TRACKING_REPORT TR, RESOURCE_INFO RI WHERE RI.GROUP_ID ='426' AND
RI.COM_ID='122' AND RI.MSISDN = TR.MSISDN GROUP BY RI.RESOURCE_NAME,
TR.MSISDN
call count cpu elapsed disk query current rows
Parse 1 0.01 0.02 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 6 13.69 389.03 81747 280722 0 72
total 8 13.70 389.05 81747 280722 0 72
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 281
Rows Row Source Operation
72 SORT GROUP BY
276558 NESTED LOOPS
79 TABLE ACCESS FULL RESOURCE_INFO
276558 TABLE ACCESS BY INDEX ROWID TRACKING_REPORT
276558 INDEX RANGE SCAN TR_INDX_ON_MSISDN_TIME (object id 60507)
********************************************************************************and the plan_table output is
STATEMENT_ID TIMESTAMP REMARKS OPERATION OPTIONS OBJECT_NODE OBJECT_OWNER OBJECT_NAME OBJECT_INSTANCE OBJECT_TYPE OPTIMIZER SEARCH_COLUMNS ID PARENT_ID POSITION COST CARDINALITY BYTES OTHER_TAG PARTITION_START PARTITION_STOP PARTITION_ID OTHER DISTRIBUTION CPU_COST IO_COST TEMP_SPACE ACCESS_PREDICATES FILTER_PREDICATES
23-Mar-11 23:36:45 SELECT STATEMENT CHOOSE 0 115 115 1058 111090 115
23-Mar-11 23:36:45 SORT GROUP BY 1 0 1 115 1058 111090 115
23-Mar-11 23:36:45 NESTED LOOPS 2 1 1 9 4603 483315 9
23-Mar-11 23:36:45 TABLE ACCESS FULL BSNL_RTMS RESOURCE_INFO 2 ANALYZED 3 2 1 8 1 30 8 "RI"."GROUP_ID"=426 AND "RI"."COM_ID"='122'
23-Mar-11 23:36:45 TABLE ACCESS BY INDEX ROWID BSNL_RTMS TRACKING_REPORT 1 ANALYZED 4 2 2 1 3293 246975 1
23-Mar-11 23:36:45 INDEX RANGE SCAN BSNL_RTMS TR_INDX_ON_MSISDN_TIME NON-UNIQUE 1 5 4 1 1 3293 1 "RI"."MSISDN"="TR"."MSISDN"
Similar Messages
-
Update query which taking more time
Hi
I am running an update query which takeing more time any help to run this fast.
update arm538e_tmp t
set t.qtr5 =(select (sum(nvl(m.net_sales_value,0))/1000) from mnthly_sales_actvty m
where m.vndr#=t.vndr#
and m.cust_type_cd=t.cust_type
and m.cust_type_cd<>13
and m.yymm between 201301 and 201303
group by m.vndr#,m.cust_type_cd;
help will be appreciable
thank you
Edited by: 960991 on Apr 16, 2013 7:11 AM960991 wrote:
Hi
I am running an update query which takeing more time any help to run this fast.
update arm538e_tmp t
set t.qtr5 =(select (sum(nvl(m.net_sales_value,0))/1000) from mnthly_sales_actvty m
where m.vndr#=t.vndr#
and m.cust_type_cd=t.cust_type
and m.cust_type_cd13
and m.yymm between 201301 and 201303
group by m.vndr#,m.cust_type_cd;
help will be appreciable
thank youUpdates with subqueries can be slow. Get an execution plan for the update to see what SQL is doing.
Some things to look at ...
1. Are you sure you posted the right SQL? I could not "balance" the parenthesis - 4 "(" and 3 ")"
2. Unnecessary "(" ")" in the subquery "(sum" are confusing
3. Updates with subqueries can be slow. The tqtr5 value seems to evaluate to a constant. You might improve performance by computing the value beforehand and using a variable instead of the subquery
4. Subquery appears to be correlated - good! Make sure the subquery is properly indexed if it reads < 20% of the rows in the table (this figure depends on the version of Oracle)
5. Is tqtr5 part of an index? It is a bad idea to update indexed columns -
Analyze a Query which takes longer time in Production server with ST03 only
Hi,
I want to Analyze a Query which takes longer time in Production server with ST03 t-code only.
Please provide me with detail steps as to perform the same with ST03
ST03 - Expert mode- then I need to know the steps after this. I have checked many threads. So please don't send me the links.
Write steps in detail please.
<REMOVED BY MODERATOR>
Regards,
Sameer
Edited by: Alvaro Tejada Galindo on Jun 12, 2008 12:14 PMThen please close the thread.
Greetings,
Blag. -
Why view have no stored data ? And what is the reason view take more time
Why view have no stored data ? And what is the reason view take more time to query ?
what happen if a view have stored data?user12941450 wrote:
I want to know the reason that why querying view is slower then querying a normal table?..Untrue.
For example take a table with 2laks record and a view for that table.
If i make a query like( Select name,address from table) then it works fast then select(name,address)from view..Incorrectly interpreting the results.
A view is a SQL statement. Only difference is that the SQL statement is stored in the database's dictionary. Let's consider the following view:
create or replace view foo_view as select * from empWhen you use the view as follows:
select * from foo_viewOracle sees it as follows:
select * from (select * from emp)This is no slower, or no faster, than providing the following SQL to Oracle:
select * from empSo if you observe a difference in performance between using plain SQL versus using that same SQL via a view, there are other reasons for that difference in performance. The reason is NOT that views are slower. -
Import SCA files in Development Tab of the Transport Studio take more time
Hi,
After Check-In files in the Transport Studio, the import of SCA files starts in the development Tab of the Transport Studio.
The import takes more time. Why this happens?
Am I missing any configuration? Please specify in detail.
Thanks in Advance,
SathyaSC: sap.com_SAP-JEE:
SDM-deploy
Returncode : Not executed.
How to check the username, password and url for SDM?
Log file of Repository-import:
Info:Starting Step Repository-import at 2009-10-13 22:15:49.0484 +5:00
Info:Component:sap.com/SAP_JTECHS
Info:Version :SAP AG.20060119105400
Info:3. PR is of type TCSSoftwareComponent
Info:Component:sap.com/SAP_BUILDT
Info:Version :SAP AG.20060411165600
Info:2. PR is of type TCSSoftwareComponent
Info:Component:sap.com/SAP-JEE
Info:Version :SAP AG.20060119105300
Info:1. PR is of type TCSSoftwareComponent
Info:Step Repository-import ended with result 'not needed' at 2009-10-13 22:15:49.0500 +5:00
Log File of CBS-make :
Import got failed.
Info:build process already running: waiting for another period of 30000 ms
Info:no changes on the CBS request queue (DM0_DEMObp1_D) after a waiting time of 14430000 ms
Fatal:The request queue is not processed by the CBS during the given time intervall => TCS cannot import the request because queue is not empty
Fatal:There seems to be a structural problem in the NWDI. Please look after the operational status of the CBS.
Fatal Exception:com.sap.cms.tcs.interfaces.exceptions.TCSCommunicationException: communication error: The request queue is not processed during the given time intervall. There seems to be a structural problem in the NWDI. Please look after the operational status of the CBS.:communication error: The request queue is not processed during the given time intervall. There seems to be a structural problem in the NWDI. Please look after the operational status of the CBS.
com.sap.cms.tcs.interfaces.exceptions.TCSCommunicationException: communication error: The request queue is not processed during the given time intervall. There seems to be a structural problem in the NWDI. Please look after the operational status of the CBS.
at com.sap.cms.tcs.client.CBSCommunicator.importRequest(CBSCommunicator.java:369)
at com.sap.cms.tcs.core.CbsMakeTask.processMake(CbsMakeTask.java:120)
at com.sap.cms.tcs.core.CbsMakeTask.process(CbsMakeTask.java:347)
at com.sap.cms.tcs.process.ProcessStep.processStep(ProcessStep.java:77)
at com.sap.cms.tcs.process.ProcessStarter.process(ProcessStarter.java:179)
at com.sap.cms.tcs.core.TCSManager.importPropagationRequests(TCSManager.java:376)
at com.sap.cms.pcs.transport.importazione.ImportManager.importazione(ImportManager.java:216)
at com.sap.cms.pcs.transport.importazione.ImportQueueHandler.execImport(ImportQueueHandler.java:585)
at com.sap.cms.pcs.transport.importazione.ImportQueueHandler.startImport(ImportQueueHandler.java:101)
at com.sap.cms.pcs.transport.proxy.CmsTransportProxyBean.startImport(CmsTransportProxyBean.java:583)
at com.sap.cms.pcs.transport.proxy.CmsTransportProxyBean.startImport(CmsTransportProxyBean.java:559)
at com.sap.cms.pcs.transport.proxy.LocalCmsTransportProxyLocalObjectImpl0.startImport(LocalCmsTransportProxyLocalObjectImpl0.java:1736)
at com.sap.cms.ui.wl.Custom1.importQueue(Custom1.java:1169)
at com.sap.cms.ui.wl.wdp.InternalCustom1.importQueue(InternalCustom1.java:2162)
at com.sap.cms.ui.wl.Worklist.onActionImportQueue(Worklist.java:880)
at com.sap.cms.ui.wl.wdp.InternalWorklist.wdInvokeEventHandler(InternalWorklist.java:2338)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doHandleActionEvent(WindowPhaseModel.java:422)
at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:133)
at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:344)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:298)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:705)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:659)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:227)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:150)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:56)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:47)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Info:Step CBS-make ended with result 'fatal error' ,stopping execution at 2009-10-14 02:16:28.0296 +5:00 -
How do we tune a query that takes more time for the first time?
Hi,
First time it takes 20 secs and subsequent times 2 secs.
Let me know if you need more info
ThanksFollowing are the parameters set at the DB level.
.__db_cache_size=2214592512
.__java_pool_size=16777216
.__large_pool_size=16777216
.__shared_pool_size=1543503872
.__streams_pool_size=33554432
*._optimizer_cost_based_transformation='off'
*._smu_debug_mode=4
*.compatible='10.2.0.1.0'
*.cursor_sharing='SIMILAR'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.job_queue_processes=10
*.open_cursors=5000
*.optimizer_mode='ALL_ROWS'
*.pga_aggregate_target=1277165568
*.processes=250
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1000
*.sga_target=3833593856
*.undo_management='AUTO'
*.undo_tablespace='UBPTAB_UNDO'
Execution Plan
Plan hash value: 2107556093
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 45157 | 29M| | 9094 (1)| 00:01
:50 |
| 1 | SORT ORDER BY | | 45157 | 29M| 78M| 9094 (1)| 00:01
:50 |
|* 2 | TABLE ACCESS FULL| <tname>| 45157 | 29M| | 2564 (2)| 00:00
:31 |
Following are result from dba_tab_statistics.
NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_CACHE_HIT_RATIO AVG_ROW_LEN
112704 11520 768 685
AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS
0 0
Follwing was the time it has taken to generate the explain plan report after issuing the below command.
set autotrace traceonly
Elapsed: 00:00:15.49
Following is the statistics
Statistics
0 recursive calls
0 db block gets
11380 consistent gets
0 physical reads
0 redo size
8823636 bytes sent via SQL*Net to client
37731 bytes received via SQL*Net from client
3019 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
45267 rows processed
Pl let us know how to tune the same.
Thank you all for the help -
[JavaWebStart] the method showDocument take more time withJWS 1.6 ?
Hi,
I'm facing currently a problem since our product was migrated to Java webstart 1.6. Indeed, this problem is the same with JRE 1.5 or 1.6, it only depends of the JavaWebstart version.
We use the method showDocument of BasicService (http://java.sun.com/j2se/1.5.0/docs/guide/javaws/jnlp/javax/jnlp/BasicService.html)
BasicService bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
bs.showDocument(file); This service is managed by JavaWebstart, that's why I have the problem independantly of the JRE version, it is only related to JavaWebstart version.
Since JWS 1.6, opening a documents takes 9 seconds when calling showDocument (it was only 1ms in JWS 1.5)
Does anybody already have this problem ?application server have 20 GB ram and DB server have 16 GB.
This is the parameter maintain in RZ10 regarding DB. Anything i want to maintain for DB memory allocation.
rsdb/obj/max_objects 20000
rsdb/obj/buffersize 40000
zcsa/db_max_buftab 10000
rsdb/cua/buffersize 10000
rsdb/ntab/irbdsize 8000
rsdb/ntab/ftabsize 60000
rsdb/ntab/entrycount 30000
j2ee/dbdriver $(DIR_EXECUTABLE)\mssjdbc\base.jar;
dbs/mss/par_stmt_cache_size 1000 -
The query which runs in 1 minute in oracle 8 takes hours in oracle 10.
I have a query which takes longer time in oracle 10. I have looked at the parameters and it all seems to be right. I dont know what other parameter has to be changed in order to make it work. The strange thing is that if I addr another criteriain the where clause then the sql runs in less than one minute. I added AND J.DEPTID Between '00000' and '99999' in the where class which is not really required as without that also the query returns data for all depts as the dept number falls between 00000 and 99999. Following is the sql which takes long time to run.
SELECT
L.HRS_ADJUST_UNPROC,L.HRS_ADJUST_YTD,L.HRS_CARRYOVER,J.DEPTID,L.COMPANY, L.EMPLID, J.HOURLY_RT, P.NAME
FROM
PS_LEAVE_ACCRUAL L, PS_JOB J, PS_LOCATION_TBL LOC, PS_PERSONAL_DATA P
WHERE
(((L.PLAN_TYPE = '50') AND
(L.ACCRUAL_PROC_DT = (SELECT MAX(L2.ACCRUAL_PROC_DT)
FROM PS_LEAVE_ACCRUAL L2
WHERE L2.EMPLID=L.EMPLID
AND L2.EMPL_RCD_NBR=L.EMPL_RCD_NBR
AND L2.PLAN_TYPE=L.PLAN_TYPE)) AND
(J.EMPL_STATUS IN( 'A', 'L', 'P')) AND
((L.HRS_ADJUST_UNPROC+L.HRS_ADJUST_YTD+L.HRS_CARRYOVER+L.HRS_EARNED_YTD-L.HRS_TAKEN_UNPROC-L.HRS_TAKEN_YTD) <> 0) AND
(L.COMPANY = 'LHS') AND
((J.EFFSEQ= (SELECT MAX(INNERALIAS.EFFSEQ)
FROM PS_JOB INNERALIAS
WHERE INNERALIAS.EMPL_RCD_NBR = J.EMPL_RCD_NBR
AND INNERALIAS.EMPLID = J.EMPLID
AND INNERALIAS.EFFDT = J.EFFDT)
AND
J.EFFDT = (SELECT MAX(INNERALIAS.EFFDT)
FROM PS_JOB INNERALIAS
WHERE INNERALIAS.EMPL_RCD_NBR = J.EMPL_RCD_NBR
AND INNERALIAS.EMPLID = J.EMPLID
AND INNERALIAS.EFFDT <= SYSDATE))) AND
((LOC.EFFDT = (
SELECT MAX(INNERALIAS.EFFDT)
FROM PS_LOCATION_TBL INNERALIAS
WHERE INNERALIAS.LOCATION = LOC.LOCATION
AND INNERALIAS.EFFDT <= SYSDATE)))))
AND
(L.EMPL_RCD_NBR = J.EMPL_RCD_NBR ) AND (L.EMPLID = J.EMPLID ) AND (J.REPORTING_LOCATION = LOC.LOCATION ) AND (L.EMPLID = P.EMPLID )
ORDER BY
J.DEPTID, P.NAMEIn fact I had tried with /*+RULE*/ hint and the query ran in 1 minute just like in Oracle 8 though the explain plan was almost same as without hintSounds like you are close to finding out what is happening differently and why it makes such a big difference. I think that was the point of Pete's suggestion, not to hope that the RULE hint would be a solution in itself. I sometimes try increasing the dynamic sampling level for the same reason.
btw please post code and execution plans in tags (see FAQ for details).
Also you can post the {noformat}<{noformat}> operator by placing {noformat} tags around the opening "<" symbol.
Edited by: William Robertson on Sep 9, 2009 10:41 PM -
Automatic DOP take more time to execute query
We upgraded database to oracle 11gR2. While testing Automatic DOP feature with our existing query it takes more time than with parallel.
Note: No constrains or Index created on table to gain performance while loading data (5000records / sec)
Os : Sun Solaris 64bit
CPU = 8
RAM = 7456M
Default parameter settings:
parallel_degree_policy string MANUAL
parallel_degree_limit string CPU
parallel_threads_per_cpu integer 2
arallel_degree_limit string CPU
cpu_count integer 8
parallel_threads_per_cpu integer 2
resource_manager_cpu_allocation integer 8
Query:
SELECT COUNT(*)
from (
SELECT
/*+ FIRST_ROWS(50), PARALLEL */
Query gets executed in 22minutes : execution plan
COUNT(*)
9600
Elapsed: 00:22:10.71
Execution Plan
Plan hash value: 3765539975
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 1 | 21 | 2164K (1)| 07:12:52 | | |
| 1 | SORT AGGREGATE | | 1 | 21 | | | | |
| 2 | PARTITION RANGE OR| | 89030 | 1825K| 2164K (1)| 07:12:52 |KEY(OR)|KEY(OR)|
|* 3 | TABLE ACCESS FULL| SUBSCRIBER_EVENT | 89030 | 1825K| 2164K (1)| 07:12:52 |KEY(OR)|KEY(OR)|Automatic DOP Query: parameters set
alter session set PARALLEL_DEGREE_POLICY = limited;
alter session force parallel query ;Query:
SELECT COUNT(*)
from (
SELECT /*+ FIRST_ROWS(50), PARALLEL*/
This query takes more than 2hrs to execute
COUNT(*)
9600
Elapsed: 02:07:48.81
Execution Plan
Plan hash value: 127536830
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart|Pstop | TQ |IN-OUT| PQ Distrib |
| 0 | SELECT STATEMENT | | 1 | 21 | 150K (1)| 00:30:01 | | | | | |
| 1 | SORT AGGREGATE | | 1 | 21 | | | | | | | |
| 2 | PX COORDINATOR | | | | | | | | | | |
| 3 | PX SEND QC (RANDOM) | :TQ10000 | 1 | 21 | | | | | Q1,00 | P->S | QC (RAND) |
| 4 | SORT AGGREGATE | | 1 | 21 | | | | | Q1,00 | PCWP | |
| 5 | PX BLOCK ITERATOR | | 89030 | 1825K| 150K (1)| 00:30:01 |KEY(OR)|KEY(OR)| Q1,00 | PCWC | |
|* 6 | TABLE ACCESS FULL| SUBSCRIBER_EVENT | 89030 | 1825K| 150K (1)| 00:30:01 |KEY(OR)|KEY(OR)| Q1,00 | PCWP | |
Note
- automatic DOP: Computed Degree of Parallelism is 16 because of degree limitcan some one help us to find out where we did wrong or any pointer will really helpful to resolve an issue.
Edited by: Sachin B on May 11, 2010 4:05 AMGenerated AWR report for ADOP
Foreground Wait Events DB/Inst: HDB/hdb Snaps: 158-161
-> s - second, ms - millisecond - 1000th of a second
-> Only events with Total Wait Time (s) >= .001 are shown
-> ordered by wait time desc, waits desc (idle events last)
-> %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Avg
%Time Total Wait wait Waits % DB
Event Waits -outs Time (s) (ms) /txn time
direct path read 522,173 0 125,051 239 628.4 99.3
db file sequential read 663 0 156 235 0.8 .1
log file sync 165 0 117 712 0.2 .1
Disk file operations I/O 267 0 63 236 0.3 .1
db file scattered read 251 0 36 145 0.3 .0
control file sequential re 217 0 32 149 0.3 .0
library cache load lock 2 0 10 4797 0.0 .0
cursor: pin S wait on X 3 0 9 3149 0.0 .0
read by other session 5 0 2 429 0.0 .0
kfk: async disk IO 613,170 0 2 0 737.9 .0
sort segment request 1 100 1 1007 0.0 .0
os thread startup 16 0 1 43 0.0 .0
direct path write temp 1 0 1 527 0.0 .0
latch free 51 0 0 2 0.1 .0
kksfbc child completion 1 100 0 59 0.0 .0
latch: cache buffers chain 19 0 0 2 0.0 .0
latch: shared pool 36 0 0 1 0.0 .0
PX Deq: Slave Session Stat 21 0 0 1 0.0 .0
library cache: mutex X 45 0 0 1 0.1 .0
CSS initialization 2 0 0 6 0.0 .0
enq: KO - fast object chec 1 0 0 11 0.0 .0
buffer busy waits 3 0 0 1 0.0 .0
cursor: pin S 9 0 0 0 0.0 .0
CSS operation: action 2 0 0 1 0.0 .0
direct path write 1 0 0 2 0.0 .0
jobq slave wait 17,554 100 8,942 509 21.1
PX Deq: Execute Reply 4,060 95 7,870 1938 4.9
SQL*Net message from clien 96 0 5,756 59962 0.1
PX Deq: Execution Msg 618 56 712 1152 0.7
KSV master wait 11 0 0 2 0.0
PX Deq: Join ACK 16 0 0 1 0.0
PX Deq: Parse Reply 14 0 0 1 0.0
Background Wait Events DB/Inst: HDB/hdb Snaps: 158-161
-> ordered by wait time desc, waits desc (idle events last)
-> Only events with Total Wait Time (s) >= .001 are shown
-> %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Avg
%Time Total Wait wait Waits % bg
Event Waits -outs Time (s) (ms) /txn time
control file sequential re 6,249 0 2,375 380 7.5 55.6
control file parallel writ 2,003 0 744 371 2.4 17.4
db file parallel write 1,604 0 503 313 1.9 11.8
log file parallel write 861 0 320 371 1.0 7.5
db file sequential read 363 0 151 415 0.4 3.5
db file scattered read 152 0 64 421 0.2 1.5
Disk file operations I/O 276 0 21 77 0.3 .5
os thread startup 316 0 15 48 0.4 .4
ADR block file read 24 0 11 450 0.0 .3
rdbms ipc reply 17 12 7 403 0.0 .2
Data file init write 6 0 6 1016 0.0 .1
direct path write 21 0 6 287 0.0 .1
log file sync 7 0 6 796 0.0 .1
ADR block file write 10 0 4 414 0.0 .1
enq: JS - queue lock 1 0 3 2535 0.0 .1
ASM file metadata operatio 1,801 0 2 1 2.2 .0
db file parallel read 30 0 1 40 0.0 .0
kfk: async disk IO 955 0 1 1 1.1 .0
db file single write 1 0 0 415 0.0 .0
reliable message 10 0 0 23 0.0 .0
latch: shared pool 75 0 0 2 0.1 .0
latch: call allocation 26 0 0 2 0.0 .0
CSS initialization 7 0 0 6 0.0 .0
asynch descriptor resize 352 100 0 0 0.4 .0
undo segment extension 2 100 0 5 0.0 .0
CSS operation: action 9 0 0 1 0.0 .0
CSS operation: query 42 0 0 0 0.1 .0
latch: parallel query allo 4 0 0 0 0.0 .0
rdbms ipc message 37,948 97 104,599 2756 45.7
DIAG idle wait 16,762 100 16,927 1010 20.2
ASM background timer 1,724 0 8,467 4912 2.1
shared server idle wait 282 100 8,465 30019 0.3
pmon timer 3,123 90 8,465 2711 3.8
wait for unread message on 8,381 100 8,465 1010 10.1
dispatcher timer 141 100 8,463 60019 0.2
Streams AQ: qmn coordinato 604 50 8,462 14010 0.7
Streams AQ: qmn slave idle 304 0 8,462 27836 0.4
smon timer 35 71 8,382 239496 0.0
Space Manager: slave idle 1,621 99 8,083 4986 2.0
PX Idle Wait 2,392 99 4,739 1981 2.9
class slave wait 46 0 623 13546 0.1
KSV master wait 2 0 0 27 0.0
SQL*Net message from clien 7 0 0 1 0.0
Wait Event Histogram DB/Inst: HDB/hdb Snaps: 158-161
-> Units for Total Waits column: K is 1000, M is 1000000, G is 1000000000
-> % of Waits: value of .0 indicates value was <.05%; value of null is truly 0
-> % of Waits: column heading of <=1s is truly <1024ms, >1s is truly >=1024ms
-> Ordered by Event (idle events last)
% of Waits
Total
Event Waits <1ms <2ms <4ms <8ms <16ms <32ms <=1s >1s
ADR block file read 24 100.0
ADR block file write 10 100.0
ADR file lock 12 100.0
ASM file metadata operatio 1812 99.0 .3 .4 .2 .1
CSS initialization 9 100.0
CSS operation: action 11 90.9 9.1
CSS operation: query 54 100.0
Data file init write 6 16.7 16.7 16.7 50.0
Disk file operations I/O 533 88.7 2.6 .6 1.5 .2 6.4
PX Deq: Signal ACK EXT 4 100.0
PX Deq: Signal ACK RSG 2 100.0
PX Deq: Slave Session Stat 21 42.9 28.6 28.6
SQL*Net break/reset to cli 6 100.0
SQL*Net message to client 102 100.0
SQL*Net more data to clien 4 100.0
asynch descriptor resize 527 100.0
buffer busy waits 4 75.0 25.0
control file parallel writ 2003 9.3 .5 .0 .1 90.0
control file sequential re 6466 10.6 .0 .0 .0 .1 .2 89.0
cursor: pin S 9 100.0
cursor: pin S wait on X 3 33.3 33.3 33.3
db file parallel read 30 6.7 30.0 63.3
db file parallel write 1604 7.4 .1 .6 16.5 75.5
db file scattered read 403 3.7 .2 2.5 13.6 14.9 3.5 61.5
db file sequential read 1017 12.3 .8 2.3 7.3 6.6 2.0 68.8
db file single write 1 100.0
direct path read 522.2 2.2 2.1 .1 .0 1.8 17.9 75.9
direct path write 22 4.5 4.5 90.9
direct path write temp 1 100.0
enq: JS - queue lock 1 100.0
enq: KO - fast object chec 1 100.0
enq: PS - contention 1 100.0
kfk: async disk IO 614.1 100.0 .0
kksfbc child completion 1 100.0
latch free 58 46.6 27.6 15.5 10.3
latch: cache buffers chain 19 36.8 10.5 52.6
latch: call allocation 26 76.9 11.5 7.7 3.8
latch: parallel query allo 4 100.0
latch: shared pool 111 44.1 28.8 27.0
library cache load lock 2 100.0
library cache: mutex X 45 84.4 8.9 4.4 2.2
log file parallel write 861 10.0 .1 .1 89.5 .2
log file sync 172 6.4 90.1 3.5
os thread startup 332 100.0
rdbms ipc reply 18 72.2 11.1 16.7
read by other session 5 100.0
reliable message 11 81.8 9.1 9.1
sort segment request 1 100.0
undo segment extension 2 50.0 50.0
ASM background timer 1724 .8 .6 .1 .6 97.9
DIAG idle wait 16.8K 100.0
KSV master wait 13 7.7 23.1 61.5 7.7
PX Deq: Execute Reply 4060 .4 .0 .0 .1 3.4 96.0
PX Deq: Execution Msg 617 34.7 1.5 2.4 1.5 1.5 .2 .8 57.5
PX Deq: Join ACK 16 93.8 6.3
PX Deq: Parse Reply 14 71.4 7.1 14.3 7.1
PX Idle Wait 2384 .0 .6 99.3
SQL*Net message from clien 103 82.5 1.0 1.9 1.0 13.6
Space Manager: slave idle 1621 .2 99.8
Streams AQ: qmn coordinato 604 50.0 50.0
Wait Event Histogram DB/Inst: HDB/hdb Snaps: 158-161
-> Units for Total Waits column: K is 1000, M is 1000000, G is 1000000000
-> % of Waits: value of .0 indicates value was <.05%; value of null is truly 0
-> % of Waits: column heading of <=1s is truly <1024ms, >1s is truly >=1024ms
-> Ordered by Event (idle events last)Edited by: Sachin B on May 11, 2010 4:52 AM -
A block of code takes more time in JRE 6_20 but less in the previous versio
while (entries.hasMoreElements()) {
ZipEntry zipEntry = (ZipEntry) entries.nextElement();
is = zipFile.getInputStream(zipEntry);
File file = new File(unzipDir, zipEntry.getName());
if (is.available() == 0) {
file.mkdir();
is.close();
} else {
file.createNewFile();
fos = new FileOutputStream(file);
CommonUtils.connectIO(is, fos, -1, true);
}Sorry a type,. The above code takes more time when I run withJDK 6_20. But its less time if the previous version is used. Cannot figure whats wrong. Here is the full method.
* Unzips the specified file into the specified directory. The optional file names list allows the caller
* to specify the actual files that get unzipped.
* @param srcFile the file to unzip
* @param unzipDir the directory where the unzipped files will be put
* @param fileNames the optional list of name strings for the zip entries to unzip or <code>null</code> to unzip
* all entries
* @throws NullPointerException if either the source file or the unzip directory is <code>null</code>
* @throws javax.faces.FacesException if the
public static void unzipFile(File srcFile, File unzipDir, List fileNames) {
if (srcFile == null) {
throw new NullPointerException("The zip file argument is null");
if (unzipDir == null) {
throw new NullPointerException("The unzip directory argument is null");
ZipFile zipFile = null;
InputStream is = null;
FileOutputStream fos = null;
try {
zipFile = new ZipFile(srcFile);
Enumeration entries = null;
if (fileNames != null) {
// Use a vector only so we can abstract away the zip entries enumeration...
Vector v = new Vector();
Iterator it = fileNames.iterator();
while (it.hasNext()) {
String name = (String) it.next();
v.add(new ZipEntry(name));
entries = v.elements();
} else {
entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry zipEntry = (ZipEntry) entries.nextElement();
is = zipFile.getInputStream(zipEntry);
File file = new File(unzipDir, zipEntry.getName());
if (is.available() == 0) {
file.mkdir();
is.close();
} else {
file.createNewFile();
fos = new FileOutputStream(file);
CommonUtils.connectIO(is, fos, -1, true);
catch (IOException e) {
throw new FacesException("Problem unzipping file " + srcFile.getAbsolutePath(), e);
finally {
try {
if (is != null) {
is.close();
if (fos != null) {
fos.close();
if (zipFile != null) {
zipFile.close();
catch (IOException e) {
throw new FacesException("Problem closing resources when unzipping file " + srcFile.getAbsolutePath(), e);
} -
Count (*) for select stmt take more time than execute a that sql stmt
HI
count (*) for select stmt take more time than execute a that sql stmt
executing particular select stmt take 2.47 mins but select stmt is using the /*+parallel*/ (sql optimer) in that sql command for faster execute .
but if i tried to find out total number of rows in that query it takes more time ..
almost 2.30 hrs still running to find count(col)
please help me to get count of row faster.
thanks in advance...797525 wrote:
HI
count (*) for select stmt take more time than execute a that sql stmt
executing particular select stmt take 2.47 mins but select stmt is using the /*+parallel*/ (sql optimer) in that sql command for faster execute .
but if i tried to find out total number of rows in that query it takes more time ..
almost 2.30 hrs still running to find count(col)
please help me to get count of row faster.
thanks in advance...That may be because your client is displaying only the first few records when you are running the "SELECT *". But when you run "COUNT(*)", the whole records has to be counted.
As already mentined please read teh FAQ to post tuning questions. -
MRP job takes more time (Duration / Sec)
Hello PP Guru’s,
I have below situation in production environment,
MRP job for plant – A (Takes more time – 14.650)
MRP job for plant – B (Takes less time – 4.512)
When I compare the variant / attributes with plant A and B, I observe only difference in attribute is scheduling (2 - Lead Time Scheduling and Capacity Planning) for plant A.
For plant B scheduling (1- Determination of Basic Dates for Planned) it was updated.
So in my observation this scheduling is playing a major role for MRB job which takes more time in plant – A.
I am in process of changing the variant attribute for plant – A from scheduling 2 to scheduling 1.
I wanted to know from experts whether if I change any impact / problem will happen in future for plant A or not.
Please let me know what all the hidden impacts are there if I change the scheduling in variant attribute.
I look forward to your valuable input to reduce time for my MRP related job.
Regards,
Kumar SHi Kumar,
You have no need to change the inhouse production time you just need to update the Lot size dependent inhouse production time in work scheduling view of material master. That you can do by scheduling the routing/recipe.
Transactions CA97 or CA97N can be used to update the in-house production time with the information from the routing.
If business don't want to have the capacity planning for planned orders then you change the scheduling from 2 to 1 basic date scheduling.
Expert Caetano already answer you query
The reports listed below can be used to compare the MRP past executions regarding the runtime:
RMMDMONI: This report compares the runtime of the MRP execution and also provides the total of planning elements (planned orders, purchase requisitions, etc) changed, created or deleted. It also shows which planning parameters where used and how much time MRP spent on each step (database read, BOM explosion, MRP calculation, scheduling, BAdIs, etc). With this information is possible to observe the relation of runtime and number of elements changed/created/deleted and also to see on which step MRP is taking more time.
RMMDPERF: This report shows the "material hit list", that means, which materials had the highest runtime during the MRP execution and also on which step MRP is taking more time. Knowing which materials have the highest runtime, allow you to isolate the problem and reproduce it on MD03, where it is possible to run an ABAP or SQL trace for a more detailed analysis.
Regards,
R.Brahmankar -
Bind variable code takes more time to complete?
Hello, My database is oracle11g.
I have same plsql code and first one is without bind variable and second one is with bind variable. Usually, bind variable should take less time. But here
the bind variable takes more time than the regular code... Can any one please explain why?
SQL> alter system flush shared_pool;
System altered.
SQL> declare
2 cursor c1 is select * from emp where rownum < 50;
3 l_start NUMBER DEFAULT DBMS_UTILITY.GET_TIME;
4 v_cnt number;
5 begin
6 for i in c1 loop
7 SELECT count(*) into v_cnt
8 FROM rate
9 WHERE rate_id IN (SELECT rate_id
10 FROM ratedetail
11 WHERE benefit_id = i.benefit_id)
12 AND effective_date =
13 TO_DATE ('2011-01-23 00:00:00', 'yyyy-MM-dd HH24:MI:SS')
14 AND rate_type_id = 1;
15 end loop;
16 DBMS_OUTPUT.PUT_LINE('total minutes....'||ROUND(ROUND((DBMS_UTILITY.GET_TIME - l_start)/100, 2)
/60,3));
17 end;
18 /
total minutes.....06
PL/SQL procedure successfully completed.
SQL> alter system flush shared_pool;
System altered.
SQL>
SQL> declare
2 cursor c1 is select benefit_id from emp where rownum < 50;
3 l_start NUMBER DEFAULT DBMS_UTILITY.GET_TIME;
4 v_cnt number;
5 begin
6 for i in c1 loop
7 execute immediate 'SELECT count(*)
8 FROM rate
9 WHERE rate_id IN (SELECT rate_id
10 FROM ratedetail
11 WHERE benefit_id = :x)
12 AND effective_date = trunc(sysdate)-202
13 AND rate_type_id = 1'
14 into v_cnt using i.benefit_id;
15 end loop;
16 DBMS_OUTPUT.PUT_LINE('total minutes....'||ROUND(ROUND((DBMS_UTILITY.GET_TIME - l_start)/100, 2)
/60,3));
17 end;
18 /
total minutes.....061
PL/SQL procedure successfully completed.
SQL>Shrinika wrote:
Thanks for the clarification.. Now i understand...
One final question on this thread before i close this thread....
My database is set to CURSOR_SHARING=FORCE for some reason. It seems somebody applied a "quick and dirty fix" to "database is slow" problem. BAD PRACTICE
My question is, when we use bind variable, does it parse the sql code every time? or does it reuse the execution plan?
In my database, it reuse the execution plan... Just checking... When we set CURSOR_SHARING=FORCE, it should generate the execution plan
for every unqiue sql code... Is that correct? Am i confusing?If by "parse" you mean a "hard parse" (which generates execution plan), then the answer is NO. As you observed, it reuses execution plan.
For e.g. with CURSOR_SHARING=FORCE setting, following SQLs
select employee_no, first_name, last_name from employees where dept_no = 10 ;and
select employee_no, first_name, last_name from employees where dept_no = 20 ;would tend to reuse the same execution plan since both of these will be rewritten by oracle (before execution) as
select employee_no, first_name, last_name from employees where dept_no = :SYS01 ;Hope this helps.
Edited by: user503699 on Aug 14, 2010 3:55 AM -
Hi
The following delete takes more time to execute.
DELETE FROM credential_on
WHERE credential_on_id IN (SELECT credential_on_id
FROM credential_on_appl
WHERE appn_num <= ANY (SELECT appn_num
FROM masterdriver));
Is there a way to tune this statement.
Regards,
XJDExplain plan for the delete query
OPERATION OPTIONS OBJECT_NAME OPTIMIZER
DELETE STATEMENT CREDENTIAL_ON CHOOSE
DELETE
MERGE JOIN
SORT JOIN
TABLE ACCESS CREDENTIAL_ON
SORT JOIN
VIEW VW_NSO_1
SORT UNIQUE
FILTER
NESTED LOOPS
TABLE ACCESS FULL CREDENTIAL_ON_APPL
TABLE ACCESS FULL MASTERDRIVER -
DELETE FROM database table takes more time...
Hi Friends,
The below statement takes more time.
LOOP AT i_final.
DELETE FROM zcisconec WHERE werks = i_final-werks
AND aufnr = i_final-aufnr
AND vornr = i_final-vornr.
ENDLOOP.
Internal table I_FINAL will have more than 80,000 records.
DB Table zcisconec have 4 primary key fields out of 10 fields.
Below 4 fields are primary key fields
WERKS
AUFNR
VORNR
MATNR
Please guide me..How to optimize it?
Regards,
VijiHI,
Check this one ,
put a break point on that delete statement and add another line of code after, like .... CHECK SY-SUBRC = 0. Now got to debug and stop at the DELETE statement, check the number of records in your DB table, now hit F5 to step to the next statement, now go back to SE16 and refresh, do you see the number change? It should.........if you are selecting the data correctly, make sure that you are getting data into the IT_ table.
DELETE zcisconec from i_final.
CALL FUNCTION 'DB_COMMIT'.
Regards,
Ansari.
Edited by: Ansari Samsudeen on Sep 15, 2009 8:14 AM
Maybe you are looking for
-
Final attempt at a solution ... broadband drop out
Perhaps someone can help before - now being contract free - I leave BT. For the last 9 months or so, we find ourselves unable to use our broadband connection without rebooting the hub. We have replaced the ADSL filter countless times, have used the
-
Font embedding problem in PDFs
Since upgrading to Leopard from Tiger- We are losing fonts embedded into pdfs, either saved through Preview or Adobe Indesign CS3. The preview of pdfs, both in the finder windows and in Entourage email attachments are missing fonts too. Sometimes ope
-
Photos in iPhoto 11 albums disappeared...
Hey all! I recently had pictures from an old drive recovered. I was given the iphoto library folder but I had built a new library with new pictures since. I used iPhoto Library Manager to merge both libraries and it worked fine until recently, all th
-
Hi All, I want to add new fields to the Additional Data A of the sales order header and and new fields to the Additional Data A of the sales order item. Can anyone please suggest me if there are any user exits or BADI's for this. Thanks, Nammi.
-
Trying to create a table but being denied access
Hi everyone, I'm relatively new to APEX. I've been building applications on the apex installation we have at my job, but this is the first time i've actually tried installing this stuff at home. I was successfully able to get 10g XE installed at home