Possible to get SQL execution timing?
Is it possible to get wall-clock timing information in thesame way as using "set timing on" in SQL*Plus?
I think the information you need is automatically displayed on the toolbar of the Sql Worksheet, to the right of the 'execute explain plan (F6)' and 'Clear (Ctrl-D)' buttons.
Similar Messages
-
Unexpected SQL execution timing
Oracle Version 9i
Win 2000/XP
We have one table comm which is a huge partitioned table (range - quarter). We had one time-taking statement that we were trying to tune -
DELETE FROM comm WHERE paid <> 'Y';
The explain plan told us that the index was not getting hit (which is understandable). The cost was around 270K odd.
We changed the statement to delete a similar numer of records -
DELETE FROM comm WHERE paid = 'N';
DELETE FROM comm WHERE paid = 'X';
DELETE FROM comm WHERE paid = 'ZZ';
This time the index was getting hit but the cost was still around 260K odd. However, the time taken to execute the 3 given statements went down from 40-minutes to 1minute!
What I am not able to understand is how come the Cost was so way off in estimation. Thanks in advance for your responses.
Additional info - the 3 statements will always use the latest partition only. However, the explain plan shows that it traverses all the partitions in both the scenarios.The query itself does not hit a specific partition - you said that the PAID column is a local partitioned index. This means that the DELETE predicate does not allow for partition pruning - only hitting specific partitions.
So depending on the volume of data to process, this can be very slow. Which is the next point. The way the predicate is constructed. A "PAID <> value" is very different than "PAID = value1 OR PAID = value2". The first requires an index range scan (if the index can be used optimally) to determine which rows have indexed values that are not equal to the stated value.
Range scans can be problem - the bigger the range, the more I/O is needed. I/O is the slowest and most expensive of all RDBMS operations.
Compare this to telling the CBO the value of PAID that you're looking for - the ideal way an index should be used.
As for the CBO costs - ignore it. Comparing the cost of one query with that of another query (or even similar query) is not a sensible thing to do. To read up what experts say on it, go to http://asktom.oracle.com and do a search on "comparing cbo costs" or something along those lines. Lots of interesting stuff there.
Is PAID index a bitmap index? Or a standard B+tree index? -
How can I get an execution plan for a Function in oracle 10g
Hi
I have:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
I would like to know if is possible to get an EXECUTION PLAN for a FUNCTION if so, how can I get it ?
RegardsYou can query the AWR data if your interesting SQL consumes enough resources.
Here is a SQL*Plus script I call MostCPUIntensiveSQLDuringInterval.sql (nice name eh?)
You'll need to know the AWR snap_id numbers for the time period of interest, then run it like this to show the top 20 SQLs during the interval:
@MostCPUIntensiveSQLDuringInterval 20The script outputs a statement to run when you are interested in looking at the plan for an interesting looking statement.
-- MostCPUintesticeSQLDuringInterval: Report on the top n SQL statements during an AWR snapshot interval.
-- The top statements are ranked by CPU usage
col inst_no format 999 heading 'RAC|Node'
col sql_id format a16 heading 'SQL_ID'
col plan_hash_value format 999999999999 heading 'Plan|hash_value'
col parsing_schema_name format a12 heading 'Parsing|Schema'
col module format a10 heading 'Module'
col pct_of_total format 999.99 heading '% Total'
col cpu_time format 999,999,999 heading 'CPU |Time (ms)'
col elapsed_time format 999,999,999 heading 'Elapsed |Time (ms)'
col lios format 9,999,999,999 heading 'Logical|Reads'
col pios format 999,999,999 heading 'Physical|Reads'
col execs format 99,999,999 heading 'Executions'
col fetches format 99,999,999 heading 'Fetches'
col sorts format 999,999 heading 'Sorts'
col parse_calls format 999,999 heading 'Parse|Calls'
col rows_processed format 999,999,999 heading 'Rows|Processed'
col iowaits format 999,999,999,999 heading 'iowaits'
set lines 195
set pages 75
PROMPT Top &&1 SQL statements during interval
SELECT diff.*
FROM (SELECT e.instance_number inst_no
,e.sql_id
,e.plan_hash_value
,e.parsing_schema_name
,substr(trim(e.module),1,10) module
,ratio_to_report(e.cpu_time_total - b.cpu_time_total) over (partition by 1) * 100 pct_of_total
,(e.cpu_time_total - b.cpu_time_total)/1000 cpu_time
,(e.elapsed_time_total - b.elapsed_time_total)/1000 elapsed_time
,e.buffer_gets_total - b.buffer_gets_total lios
,e.disk_reads_total - b.disk_reads_total pios
,e.executions_total - b.executions_total execs
,e.fetches_total - b.fetches_total fetches
,e.sorts_total - b.sorts_total sorts
,e.parse_calls_total - b.parse_calls_total parse_calls
,e.rows_processed_total - b.rows_processed_total rows_processed
-- ,e.iowait_total - b.iowait_total iowaits
-- ,e.plsexec_time_total - b.plsexec_time_total plsql_time
FROM dba_hist_sqlstat b -- begining snap
,dba_hist_sqlstat e -- ending snap
WHERE b.sql_id = e.sql_id
AND b.dbid = e.dbid
AND b.instance_number = e.instance_number
and b.plan_hash_value = e.plan_hash_value
AND b.snap_id = &LowSnapID
AND e.snap_id = &HighSnapID
ORDER BY e.cpu_time_total - b.cpu_time_total DESC
) diff
WHERE ROWNUM <=&&1
set define off
prompt to get the text of the SQL run the following:
prompt @id2sql &SQL_id
prompt .
prompt to obtain the execution plan for a session run the following:
prompt select * from table(DBMS_XPLAN.DISPLAY_AWR('&SQL_ID'));
prompt or
prompt select * from table(DBMS_XPLAN.DISPLAY_AWR('&SQL_ID',NULL,NULL,'ALL'));
prompt .
set define on
undefine LowSnapID
undefine HighSnapIDI guess you'll need the companion script id2sql.sql, so here it is:
set lines 190
set verify off
declare
maxDisplayLine NUMBER := 150; --max linesize to display the SQL
WorkingLine VARCHAR2(32000);
CurrentLine VARCHAR2(64);
LineBreak NUMBER;
cursor ddl_cur is
select sql_id
,sql_text
from v$sqltext_with_newlines
where sql_id='&1'
order by piece
ddlRec ddl_cur%ROWTYPE;
begin
WorkingLine :='.';
OPEN ddl_cur;
LOOP
FETCH ddl_cur INTO ddlRec;
EXIT WHEN ddl_cur%NOTFOUND;
IF ddl_cur%ROWCOUNT = 1 THEN
dbms_output.put_line('.');
dbms_output.put_line(' sql_id: '||ddlRec.sql_id);
dbms_output.put_line('.');
dbms_output.put_line('.');
dbms_output.put_line('SQL Text');
dbms_output.put_line('----------------------------------------------------------------');
END IF;
CurrentLine := ddlRec.sql_text;
WHILE LENGTH(CurrentLine) > 1 LOOP
IF INSTR(CurrentLine,CHR(10)) > 0 THEN -- if the current line has an embeded newline
WorkingLine := WorkingLine||SUBSTR(CurrentLine,1,INSTR(CurrentLine,CHR(10))-1); -- append up to new line
CurrentLine := SUBSTR(CurrentLine,INSTR(CurrentLine,CHR(10))+1); -- strip off up through new line character
dbms_output.put_line(WorkingLine); -- print the WorkingLine
WorkingLine :=''; -- reset the working line
ELSE
WorkingLine := WorkingLine||CurrentLine; -- append the current line
CurrentLine :=''; -- the rest of the line has been processed
IF LENGTH(WorkingLine) > maxDisplayLine THEN -- the line is morethan the display limit
LineBreak := instr(substr(WorkingLine,1,maxDisplayLine),' ',-1); --find the last space before the display limit
IF LineBreak = 0 THEN -- there is no space, so look for a comma instead
LineBreak := substr(WorkingLine,instr(substr(WorkingLine,1,maxDisplayLine),',',-1));
END IF;
IF LineBreak = 0 THEN -- no space or comma, so force the line break at maxDisplayLine
LineBreak := maxDisplayLine;
END IF;
dbms_output.put_line(substr(WorkingLine,1,LineBreak));
WorkingLine:=substr(WorkingLine,LineBreak);
END IF;
END IF;
END LOOP;
--dbms_output.put(ddlRec.sql_text);
END LOOP;
dbms_output.put_line(WorkingLine);
dbms_output.put_line('----------------------------------------------------------------');
CLOSE ddl_cur;
END;
/ -
How to get the SQL Execution Plan from complex Extractors ?
Hi
I am looking for a way to get the
SQL Execution Plan(s!)
from
Complex Extractors like 0CO_OM_CCA_9 ?
Anybody has got a suggestion ?
How to get this in SM50 ?
ThanXs
MartinIdentifying the query is the hard part. If you can identify it(based on table access or some such parameter, getting the execution plan is easy in ST04 .
-
Hi Experts,
We run a report which fails frequently with the below error. Could any one help me with the solution and reasons for this error.
Error during SQL execution: (DA0003): [Exception: DBD, ORA-01722: invalid number State: N/A] The following data providers have not been successfully refreshed: His. (DMA0007): []
Connection or SQL sentence error: (DA0005): [Exception: DBD, ORA-12535: TNS:operation timed out State: N/A] A connection required to refresh this document is unavailable. (DA0004): [] The following data providers have not been successfully refreshed: Reservations CW. (DMA0007): []
Many Thanks
Regards,
SyedHi,
The report is running for long time and it's getting failed. could you please let me know what could be the reason for this?
And could you please tell me the reason/Solution for the first error which i mentioned before.
Many Thanks
Regards,
Syed -
How to get the execution time of a query
Hi,
Environment: 10.2.0.4.0
Just wondering how I can get the query execution time? I am not interested in the query output nor do I want the statistics, just the execution time?
Any suggestions will be appreciated
Thanks in advance
rogers42If you're using SQL*Plus
SQL> set autotrace traceonly
SQL> set timing on
SQL> <<your query here>>SQL*Plus will fetch all the data and then report the query plan, execution statistics, and elapsed time. It will not display the actual data.
SET TIMING ON alone tells SQL*Plus to display the execution time of each SQL statement-- the problem is that it also displays all the data which can skew the results because you're including the time required by SQL*Plus to pipe a bunch of data to the screen.
Justin -
Need help Recording SQL Execution Times in Database
Hello,
I have an interesting thing I am tiring to do. I want to record how much time (Wall Clock) it took the database to execute any select statement against o one particular view lets call it CUST_ORDERS_V.
I would like to record who ran it, what the select statement was (SQL Text) and how much time it took and maybe a few other ancillary things if possible.
Looking at most of my requirements took me right to Oracle Auditing and the SYS.AUD$ table. After setting up auditing with:
audit_trail=db,extended
and
audit select on ME.CUST_ORDERS_V by access;I get every piece of information I need except for the execution time! Wow that would be great if Oracle recorded that!!! So I was thinking if I could. I was considering a trigger on SYS.AUD$ (I know evil thoughts) that would look into some V$ view and get the execution time and write it into some custom table with a link back to SYS.AUD$.
This might be the complete wrong way to do it. I was wondering if anyone had any ideas on this.
I am running on 11.2.0.3 EE. I am on EE so I can use Fine Grained Auditing if it is needed. However I DO NOT have the Tuning or Diagnostic Pack.>
Hi again,
Yes, a complete set of times from end to end would be great. However
for now I need to stick with what is in my domain of control, the database.
Maybe after the DB I will look to get the others.But your point about the operators blaming the db brings up the probability
that after you tell them that the db is not the issue, they'll start to blame
the app server, the cabling, their OS, the browser, the tea-lady...
If you have click===> page, they have no more places to hide and have to
actually work for a living ;)
I do not think I can access v$active_session_history as I do not have the Tuning Pack.Well, presumably there is a business case for this project. Why not tell management
that it's required?
Otherwise, you could go to ashmasters.com - a site run by Kyle Hailey (Oak Table
member and author). He has an Open Source ASH "substitute" which you might
like to try - haven't used it myself, but if Kyle Hailey's behind it, then it's at
least worthy of investigation.
HTH,
Paul... -
How can I get SQL query excution time
Hi ,
When I run a query , How can i get total execution time for that query.
Thanks,
Regards,
Basha.There are several ways:
1. In SQL, issue SET TIMING ON
2. Trace your query:
- ALTER SESSION SQL_TRACE=TRUE;
- Execute your query
- ALTER SESSION SET SQL_TRACE=FALSE
- Decode the tracefile left at USER_DUMP_DEST using TKPROF. -
SSIS 2012 Scheduled SSIS package fail to start – Execution timed out
Hi
I am currently running into an issue that seem to have a live Connect issue raised for it. The following is the link to the connect issue https://connect.microsoft.com/SQLServer/feedback/details/783291/ssis-package-fails-to-start-application-lock-timeout-in-ssisdb-catalog-create-execution
There is also a blog post that explains this issue in more detail, however the solution
it provides does not work all the time and I am very reluctant to create custom stored procedures in the SSISDB. http://speaksql.wordpress.com/2013/06/27/ssis-2012-fail-to-start-execution-timed-out/
Just to give some more background. When scheduling 10 or more, in my case I scheduled 14, SQL Server Agent Jobs all executing a package in the SSIS Catalog and all kicking off on exactly the same time about 10% to 20% of these jobs fail stating one of the
following error messages:
The operation failed because the execution timed out. Source: .Net SqlClient Data Provider Started: 12:20:01 Finished: 12:20:07 Elapsed: 5.797 seconds. The package execution failed. The step failed.
Description: Transaction (Process ID 66) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. Source: .Net SqlClient Data Provider Started: 14:06:48 Finished: 14:06:53
Elapsed: 4.719 seconds. The package execution failed. The step failed.
This timeout takes place both when using TSQL to start the package in the Job or when the step in the Job is set to start the package as an Integration Services Package.
Steps to recreate this:
1. Create one SSIS package that simply executes for around a minute. For example you can use an Execute SQL Task and simply execute the following TSQL "WAITFOR DELAY '00:01:00'"
2. Create 14 SQL Server Agent Jobs each executing the same package and schedule all of them to run at the same time.
3. Watch the execution of the jobs take place and note the failures. (This does not always happen and you might get one run in which everything executes without a problem. The next run might have 6 or 7 of the jobs fail.)
You can also create 14 different SSIS packages, one for each job, and the result is the same.
I am running on SQL 2012 SP1 CU4. Windows Server 2012 R2 patched to the lastest patch level.
This issue does not happen when the packages are deployed to the SSIS Package Store the way that it was done in SQL2008 and before. It only occurs when the SSIS packages are deployed to the SSIS Catalog.
Any help or feedback on this would be greatly appreciated.
Kind Regards,
Christo OlivierHi Tom
Thank you for the fast response. I went and increased the value by 1024KB instead of the initial
512KB. Unfortunately this seems to only alleviate the issue but does not stop it from occurring. It
is happening much less often now but still occurring intermittently.
Regards,
Christo -
XML DB: is it possible to get a row for each element in a container element?
I have an XML document containing a container element (collection). If I query, using an XPath expression, the contained elements I get a row for each container element with the contained element concatenated. Is it possible to get a row for each contained element?
I run this simple query:
select extract(xmltype('<colors><color>Red</color><color>Green</color></colors>')
, '/colors/color/text()').getstringval() from dual
And get this result:
EXTRACT(XMLTYPE('<COLORS><COLOR>RED</COLOR><COLOR>GREEN</COLOR></COLORS>'),'/COL
RedGreen
1 row selected.
What I would like to have is:
Red
Green
2 rows selected.
Wishful thinking or possible? Many thanks!Sure. This is where our XMLSequence() function comes in. It allows you to treat the top-level nodes in a nodeset as if they were rows in a table when combined with the TABLE() operator. Here's an example.
First, to make the SQL look a little cleaner, I like to define a function like this:
create or replace function testdoc return xmltype as
begin
return xmltype('<colors><color>Red</color><color>Green</color></colors>');
end;.
To break out the nodeset of <color> elements as a table, we use the following query:
select value(list_of_color_elements).extract('*/text()').getStringVal() as color
from TABLE( XMLSequence( extract(testdoc(),'/colors/color'))) list_of_color_elements.
Or, using the new-in-9.2 extractValue() operator so we don't have to remember the text() part:
select extractValue( value(list_of_color_elements), '.') as color
from TABLE( XMLSequence( extract( testdoc() ,'/colors/color'))) list_of_color_elements.
Here the TABLE(XMLSequence(...)) combo produces a table of XMLType, with one XMLType object in each row of the table.
In general, if the XMLType instance were coming from an XMLType table xmltab the query would look like this:
select extractValue( value(colors), '.') as color
from xmltab x, /* Important that this table comes earlier in the FROM clause! */
TABLE( XMLSequence( extract( value(x),'/colors/color'))) colors.
And if the XMLType were instead in a column of XMLType named doc in a table xmltab, then we would have the syntax:
select extractValue( value(colors), '.') as color
from xmltab x, /* Important that this table comes earlier in the FROM clause! */
TABLE( XMLSequence( extract( x.doc ,'/colors/color'))) colorsOnce you get the hang of it, you'll see that the combination of TABLE(XMLSequence()) to "shred" XML nodes into rows, and XMLAgg() to aggregate fragments of XML across multiple rows back into a single document, is quite powerful. -
Sudden increase in buffer gets per executions in update statement
Hi,
Recently we have encountered one performance issue, which is most likely caused by a sudden increase in the buffer gets per execution.
The SQL is an update statement, updating a table using a primary key (we have checked to confirm the running execution plan is using the primary key), and one field being updated is a BLOB column.
As shown in the below statistics, there is no major change in the number of executions during the every 20 minutes monitoring interval. However, the buffer gets per executions has been more than double, and the CPU time is almost doubled, hence the exec_time (elapsed time) has been doubled.
The same SQL has been running for the past four years in multiple similar databases. The database is Oracle 9.2.0.4 running on Solaris 9. For the past 300 days, the average elapsed time per execution is about 0.0093s, while the average buffer gets per execution is about 670. The update statement has been executed about 9 times per second.
The question is why there is a sudden increase in the buffer gets? The sudden increase happened twice for the past two days.
<pre>
B_TIME E_TIME EXECUTIONS_DIFF EXEC_TIME CPU_TIME BUFFER_GETS EXEC_PER_DAY
2009-11-25-14:04 2009-11-25-14:23 8513 .0069 .0068 315.56 646329
2009-11-25-14:23 2009-11-25-14:43 10170 .007 .0068 312.28 726188
2009-11-25-14:43 2009-11-25-15:05 11873 .0072 .0069 320.17 787885
2009-11-25-15:05 2009-11-25-15:23 8633 .011 .0101 844.83 675014
2009-11-25-15:23 2009-11-25-15:44 9668 .0144 .0137 1448.51 680778
2009-11-25-15:44 2009-11-25-16:04 9671 .0163 .0156 1809.04 702163
2009-11-25-16:04 2009-11-25-16:25 10260 .0188 .0177 2107.67 711447
2009-11-25-16:25 2009-11-25-16:44 9827 .0157 .0151 1834.3 739593
2009-11-25-16:44 2009-11-25-17:05 10586 .0171 .0164 2008.25 714555
2009-11-26-08:04 2009-11-26-08:24 11028 .0182 .0172 1979.61 800688
2009-11-26-08:24 2009-11-26-08:44 10533 .0154 .0149 1734.62 750248
2009-11-26-08:44 2009-11-26-09:04 9367 .018 .0168 2043.95 685274
2009-11-26-09:04 2009-11-26-09:24 10307 .0214 .0201 2552.43 729938
2009-11-26-09:24 2009-11-26-09:45 10932 .0251 .0234 3111.48 762328
2009-11-26-09:45 2009-11-26-10:05 10992 .0278 .0254 3386.41 797404
2009-11-26-15:03 2009-11-26-15:16 7183 .0425 .0348 4615.42 746824
2009-11-26-15:16 2009-11-26-15:23 2921 .0417 .0373 4887.75 682092
2009-11-26-15:23 2009-11-26-15:43 9597 .0393 .0352 4603.62 679656
2009-11-26-15:43 2009-11-26-16:03 8797 .0411 .0362 4783.66 630755
2009-11-26-16:03 2009-11-26-16:23 9957 .0453 .0391 5168.28 718100
2009-11-26-16:23 2009-11-26-16:43 11209 .0436 .0369 4870.77 808395
2009-11-26-16:43 2009-11-26-17:03 10729 .0428 .0375 5119.56 766103
2009-11-26-17:03 2009-11-26-17:23 9116 .0409 .0363 4912.58 659098
</pre>
Yesterday I did a trace on one of the sessions running the update statement, and below is the tkprof output:
<pre>
call count cpu elapsed disk query current rows
Parse 76 0.03 0.00 0 0 0 0
Execute 76 4.58 5.14 0 567843 19034 76
Fetch 0 0.00 0.00 0 0 0 0
total 152 4.61 5.14 0 567843 19034 76
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 88
Rows Row Source Operation
1 UPDATE (cr=30 r=0 w=0 time=6232 us)
1 INDEX UNIQUE SCAN <PK Index Name> (cr=3 r=0 w=0 time=58 us)(object id 81122)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
Waited--------------------------------------------------------------------------------
SQL*Net message to client 152 0.00 0.00
SQL*Net message from client 152 0.00 0.22
SQL*Net more data from client 1894 0.00 0.03
SQL*Net break/reset to client 152 0.00 0.00
buffer busy waits 14 0.00 0.00
enqueue 1 0.61 0.61
</pre>
GaoYuanHi,
I've reformatted your output for better understanding (with {noformat}...{noformat}):
B_TIME E_TIME EXECUTIONS_DIFF EXEC_TIME CPU_TIME BUFFER_GETS EXEC_PER_DAY
2009-11-25-14:04 2009-11-25-14:23 8513 .0069 .0068 315.56 646329
2009-11-25-14:23 2009-11-25-14:43 10170 .007 .0068 312.28 726188
2009-11-25-14:43 2009-11-25-15:05 11873 .0072 .0069 320.17 787885
2009-11-25-15:05 2009-11-25-15:23 8633 .011 .0101 844.83 675014
2009-11-25-15:23 2009-11-25-15:44 9668 .0144 .0137 1448.51 680778
2009-11-25-15:44 2009-11-25-16:04 9671 .0163 .0156 1809.04 702163
2009-11-25-16:04 2009-11-25-16:25 10260 .0188 .0177 2107.67 711447
2009-11-25-16:25 2009-11-25-16:44 9827 .0157 .0151 1834.3 739593
2009-11-25-16:44 2009-11-25-17:05 10586 .0171 .0164 2008.25 714555
2009-11-26-08:04 2009-11-26-08:24 11028 .0182 .0172 1979.61 800688
2009-11-26-08:24 2009-11-26-08:44 10533 .0154 .0149 1734.62 750248
2009-11-26-08:44 2009-11-26-09:04 9367 .018 .0168 2043.95 685274
2009-11-26-09:04 2009-11-26-09:24 10307 .0214 .0201 2552.43 729938
2009-11-26-09:24 2009-11-26-09:45 10932 .0251 .0234 3111.48 762328
2009-11-26-09:45 2009-11-26-10:05 10992 .0278 .0254 3386.41 797404
2009-11-26-15:03 2009-11-26-15:16 7183 .0425 .0348 4615.42 746824
2009-11-26-15:16 2009-11-26-15:23 2921 .0417 .0373 4887.75 682092
2009-11-26-15:23 2009-11-26-15:43 9597 .0393 .0352 4603.62 679656
2009-11-26-15:43 2009-11-26-16:03 8797 .0411 .0362 4783.66 630755
2009-11-26-16:03 2009-11-26-16:23 9957 .0453 .0391 5168.28 718100
2009-11-26-16:23 2009-11-26-16:43 11209 .0436 .0369 4870.77 808395
2009-11-26-16:43 2009-11-26-17:03 10729 .0428 .0375 5119.56 766103
2009-11-26-17:03 2009-11-26-17:23 9116 .0409 .0363 4912.58 659098
call count cpu elapsed disk query current rows
Parse 76 0.03 0.00 0 0 0 0
Execute 76 4.58 5.14 0 567843 19034 76
Fetch 0 0.00 0.00 0 0 0 0
total 152 4.61 5.14 0 567843 19034 76
Misses in library cache during parse: 1
Optimizer goal: CHOOSE
Parsing user id: 88
Rows Row Source Operation
1 UPDATE (cr=30 r=0 w=0 time=6232 us)
1 INDEX UNIQUE SCAN <PK Index Name(cr=3 r=0 w=0 time=58 us)(object id 81122)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
SQL*Net message to client 152 0.00 0.00
SQL*Net message from client 152 0.00 0.22
SQL*Net more data from client 1894 0.00 0.03
SQL*Net break/reset to client 152 0.00 0.00
buffer busy waits 14 0.00 0.00
enqueue 1 0.61 0.61
********************************************************************************Can you please provide a DDL for the table, indexes, type of the tablespace(s) they reside in (ASSM/MSSM, extents sizes), the UPDATE statement, how many sessions on average/peaks are doing the same thing concurrently, how many sessions are working this table concurrently and how do they use it? -
Following is my Query unable to update when Executed table gets lock Execution does not stop even for an hour.
update Employees
set Status = 'Close'
where statusid IN (select statusid
from MyView
where DownloadedDate ='2014-07-27 00:00:00.000'
here Employee contains 3,00,000 of records and Subquery return 1,50,000 Empid
i tried in various ways but not able to solve, statusid column have no index on, i tried using cursor but it does not work.
plz let me know how to solve this Issue, THANKS IN ADVANCE.Hello,
You should better post your question to a more related Forum, like Transact-SQL or SQL Server Database Engine; this Forum is for samples & community Projects.
Have you checked the execution plan if indexes are used?
You could update the data in chunks, e.g. 10.000 rows per execution. For this you have to add a TOP clause and a filter to update only those, who are not updated yet.
update TOP (10000) Employees
set Status = 'Close'
where statusid IN
(select statusid
from MyView
where DownloadedDate ='2014-07-27 00:00:00.000')
AND Status <> 'Close'
Olaf Helper
[ Blog] [ Xing] [ MVP] -
My coldfusion service crashes intermitantly and when I check
the application logs the error that I see for the time frame is the
one below. Does anyone know where I might begain to solve this?
Thanks!
Error Executing Database
Query.coldfusion.sql.DatabaseConnectionException: Timed out trying
to establish connection The specific sequence of files included or
processed is: E:\wwwroot\lifeworks\default.cfmI'm no expert, but thought I would try to be helpful.
I was getting this same error on a regular basis.
The short term fix was to restart the ODBC server service.
The long term fix was twofold:
1. I recreated the ODBC connection in ColdFusion
Administrator to use the system connection (I was using the SA and
PW for login).
2. I created a second user ODBC connection as well as the
system one under ODBC in Windows Server 2003.
I haven't had the problem since.
I also read a pretty good set of "stuff" to try from the help
area:
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_17277
Hope this helps. -
Backtrace of ABAP and SQL execution
Hello everyone!
Does anybody know how to see logs of ABAP and SQL execution. I saw SLG1 but didn't found this information.
I'm not interested in writing to SLG, I want to have opportunity to see the User, who deleted some entries from tables or launched ABAP code, for example.Do you mean transcation SCU3 for viewing table changes?
Yes
About ABAP-SQL execution... I can't foresee which program will be executed and which table will be effected, so I need some report that shows for particular table which statement was executed, and report about list of programs run by user. Do you know this?
You can see which transaction is executed by a user on given period of time by using transaction ST03
But which table accessed or which sql executed, in a scenrio in which you cannot forsee then its not possible.
a® -
Possible to get variable name?
Is it possible to get the name that you have used in your code of a variable?
ie.
procedure main_procedure
is
l_var varchar2(10) := 'Hello';
begin
dbms_output.put_line(get_var_name(l_var));
end;
function get_var_name(p_var in varchar2)
return varchar2
is
begin
-- insert magic here
end;
-- End code; Now call the procedure
exec main_procedure;-- Needed output:
"variable passed had name l_var and value Hello"Hi Sam,
OK, this is definitely for fun only and NOT recommended for any production database!!
With that out of the way, this has been adapted from Tom Kyte's who_called_me:
SQL> create or replace procedure get_var_name (
2 p_var in varchar2
3 )
4 as
5 call_stack varchar2(4096) default dbms_utility.format_call_stack;
6 n number;
7 found_stack boolean default false;
8 l_line varchar2(255);
9 cnt number := 0;
10 l_owner varchar2(255);
11 l_name varchar2(255);
12 lineno number;
13 caller_t varchar2(255);
14 calling_line varchar2(4000);
15 var_name varchar2(1000);
16 begin
17 loop
18 n := instr( call_stack, chr(10) );
19 exit when ( cnt = 3 or n is null or n = 0 );
20 l_line := substr( call_stack, 1, n-1 );
21 call_stack := substr( call_stack, n+1 );
22 if ( not found_stack ) then
23 if ( l_line like '%handle%number%name%' ) then
24 found_stack := true;
25 end if;
26 else
27 cnt := cnt + 1;
28 -- cnt = 1 is ME
29 -- cnt = 2 is MY Caller
30 -- cnt = 3 is Their Caller
31 if ( cnt = 2 ) then
32 lineno := to_number(substr( l_line, 13, 6 ));
33 l_line := substr( l_line, 21 );
34 if ( l_line like 'pr%' ) then
35 n := length( 'procedure ' );
36 elsif ( l_line like 'fun%' ) then
37 n := length( 'function ' );
38 elsif ( l_line like 'package body%' ) then
39 n := length( 'package body ' );
40 elsif ( l_line like 'pack%' ) then
41 n := length( 'package ' );
42 elsif ( l_line like 'anonymous%' ) then
43 n := length( 'anonymous block ' );
44 else
45 n := null;
46 end if;
47 if ( n is not null ) then
48 caller_t := ltrim(rtrim(upper(substr( l_line, 1, n-1 ))));
49 else
50 caller_t := 'TRIGGER';
51 end if;
52
53 l_line := substr( l_line, nvl(n,1) );
54 n := instr( l_line, '.' );
55 l_owner := ltrim(rtrim(substr( l_line, 1, n-1 )));
56 l_name := ltrim(rtrim(substr( l_line, n+1 )));
57 end if;
58 end if;
59 end loop;
60 select text
61 into calling_line
62 from all_source
63 where line = lineno
64 and type = caller_t
65 and name = l_name
66 and owner = l_owner;
67 var_name := trim ( substr (
68 calling_line
69 , instr(calling_line, '(') + 1
70 , instr(calling_line, ')') - instr(calling_line, '(') - 1
71 ));
72 dbms_output.put_line('variable passed had name '||var_name||' and value '||p_var);
73 end;
74 /
Procedure created.
SQL> create or replace procedure main_procedure
2 is
3 l_var varchar2(10) := 'Hello';
4 begin
5 get_var_name(l_var);
6 end;
7 /
Procedure created.
SQL> exec main_procedure;
variable passed had name l_var and value Hello
PL/SQL procedure successfully completed.cheers,
Anthony
Maybe you are looking for
-
How do i migrate info from apple 2.26 13″ (Mid-2009) to new macbook pro 13
What is best way to migrate all info from apple 2.26 13″ (Mid-2009) to new 2.3 13" macbook pro Core i5?
-
Triggering an event with more than one item.
Hello there, I've written an addon, part of which populates a UDF on the Validate event of the ItemCode Cell of the matrix on the Sales Order form. Although this works fine when the user inputs a single item, if the user selects multiple items from t
-
I have a problem with my subwoofer. I have a Logitech 5. Speaker system and a soundblaster 5. sound card. I know the speakers are connected properly because i checked using the diagnostics. However on a random basis a song will start with the subwoof
-
How to solve the mail box size limit for thunderbird
Hi, I tried to do archiving for my mails but everytime it will prompt me mail box size limit has reached and ask me to delete older mails and the problem is my HDD is more than enough to contain those archives so am asking if there's anything which i
-
Documents of Object Oriented of ABAP, I need.
Hi people, I need urgent a documentation of Object Oriented of ABAP, if some body have one send to me please. [email protected] Thanks...