Query elapsed time

Hi,
Oracle version: 8.1.7.4
I run DBMS_STATS.GATHER_SCHEMA_STATS (OwnName => 'TOM') and now I need the elapsed time between a table and another.
for example in dba_tables I have:
TABLE_NAME          LAST_ANALYZED
TAB1               2012/10/01 18:00:00
TAB2               2012/10/01 19:00:00
TAB3               2012/10/01 19:30:00
TAB4               2012/10/01 19:40:20
...........................................I'd like to get this output: TABLE_NAME_FIRST     TABLE_NAME_SECOND               ELAPSED_TIME
TAB1                    TAB2                         1 h
TAB2                    TAB3                         30 min     
TAB3                    TAB4                         10 min - 20 sec.               Have anyone how can i write this query?
Thanks in advance!

Oracle version: 8.1.7.4You're in luck, the analytic function you need is available in your version :
SQL> select table_name as table1
  2       , lead(table_name) over(order by last_analyzed) as table2
  3       , numtodsinterval(
  4           lead(last_analyzed) over(order by last_analyzed)
  5           - last_analyzed
  6         , 'DAY'
  7         ) as elapsed
  8  from user_tables
  9  where table_name not like 'SYS%'
10  ;
TABLE1                         TABLE2                         ELAPSED
TEST_DATA                      XML_DOCUMENT_TABLE             +000000001 00:00:03.000000000
XML_DOCUMENT_TABLE             PKT_MASTER                     +000000005 23:59:56.000000000
PKT_MASTER                     TEST2                          +000000000 00:00:00.000000000
TEST2                          EVAL_IDX_TAB                   +000000000 11:28:04.000000000
EVAL_IDX_TAB                   STRUCTURED_INDEX_TEST          +000000000 12:32:02.000000000
STRUCTURED_INDEX_TEST          PATHS                          +000000000 00:00:00.000000000
PATHS                          XML_T2_PATH_TABLE              +000000000 11:50:17.000000000
[...]

Similar Messages

  • Couldnt find query elapsed time  version 2.1.1.64

    Hi All,
    I have oracle sql devloper 2.1.1.64. can you please help me how to find the query elapsed time in this? i tried the help option but couldnt figure out correctly. not cant we see the query elapsed time in sql devloper at all ?

    Then you can:
    1) temporarily modify the
    Tools -> Preferences -> Database -> Advanced -> Sql Array Fetch Sizeparameter to fetch all the records you need.
    2) simply hit Ctrl-Pag down to fetch all the remaining records
    3) run as script (using F5).

  • How to findout the sql query elapsed time for last call

    RDBMS vesrion: 11.2.0.3
    How can I get the stats like how much time it took for a query to run if I know the "sql_id"
    I can query v$sql and find out the "parse_calls","fetches","execution","elapsed_time" (microsecs)
    but if the query executed 20 times then the elapsed time will be the cumulative of all the executions.
    But I want to know the ELAPSED TIME of LAST CALL(last execution only) for that sql_id.
    Edited by: rcc50886 on Aug 2, 2012 8:35 AM

    You can easily monitor the statement and see the results for v$sql_monitorWe didn't enabled the monitor for the sql's and its not possible in my current enveronment due to some issues with management.
    Is there any way to find out the last elapsed time for the sql with known sql_id ?

  • ORA-1555  ORA-3136 errors:: elapsed time vs Query Duration

    Dear all,
    - My Database version is 11.2.0.2, Solaris.
    - We have been having a problem in the production database where the front end nodes start going up and down for couple of hours sometimes. ; When node flapping is going on we get connection timed out alerts.
    WARNING: inbound connection timed out (ORA-3136) opiodr aborting
    process unknown ospid (4342) as a result of ORA-609 opiodr aborting
    process unknown ospid (4532) as a result of ORA-609 opiodr aborting
    process unknown ospid (4534) as a result of ORA-609 opiodr aborting....
    Since this week node flapping is happening every day. Since past 2 days after or during node flapping we are getting ORA-1555 error.
    Extract from alert log error:
    ORA-01555 caused by SQL statement below (SQL ID: g8804k5pkmtyt, Query Duration=19443 sec, SCN: 0x0001.07bd90ed):
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.parentDeviceId, d.created, d.lastModified AS devLastMod, d.customerId, d.userKey1, d.userKey2, d.userKey4, d
    .userKey5, d.firmwareFamily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.userKey6, d.provisioningId, d.status, d.classification, d.population, d.name, d.ipRe
    solver, d.ipExpirationTime, d.geoLocationId,contact.firstContactTime, ifaces.id, ifaces.type AS ifaceType, ifaces.lastModified AS ifaceLastMod, ifaces.timeoutname, ifac
    es.username1, ifaces.password1, ifaces.username2, ifaces.password2, ifaces.connReqUrl, ifaces.connReqScheme, ifaces.srvNonce, ifaces.deviceNonce, ifaces.phoneNumber,ifa
    ces.bootstrapSecMethod, ifaces.srvAuthentication, ifaces.deviceAuthentication, ifaces.userPIN, ifaces.networkID, ifaces.omaSessionID, ifaces.portNum, ifaces.mgtIp, ifac
    es.cmtsIp, ifaces.mgtReadCommunity, ifaces.mgtWriteCommunity, ifaces.cmtsReadCommunity, ifaces.cmtsWriteCommunity, devto.name AS devtoName, devto.rebootTimeout, devto.sessionInitiationI run Statspack report from the whole day duration, and looking into the elapsed time in seconds no more than 3739.61 sec (too lower than run duration in the alert log file of 19443 sec); So I would like to know if there is any co-relations between the ORA-3136 errors and the ORA-1555 errors?
       CPU                  CPU per             Elapsd                     Old
      Time (s)   Executions  Exec (s)  %Total   Time (s)    Buffer Gets  Hash Value
    tTime <= :3 ) AND (endTime IS NULL OR endTime >= :4 )
       2773.77    7,787,914       0.00    3.4    3739.61     112,671,645 1909376826
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
    SQL> show parameter UNDO_MANAGEMENT
    NAME                                 TYPE        VALUE
    undo_management                      string      AUTO
    SQL> show parameter UNDO_RETENTION
    NAME                                 TYPE        VALUE
    undo_retention                       integer     10800BR,
    Diego

    Thank you. Please let me know if it is enough or you need more information;
    SQL ordered by Gets  DB/Inst: DB01/db01  Snaps: 14835-14846
    -> End Buffer Gets Threshold:    100000 Total Buffer Gets:     677,689,568
    -> Captured SQL accounts for   73.6% of Total Buffer Gets
    -> SQL reported below exceeded  1.0% of Total Buffer Gets
                                                         CPU      Elapsd     Old
      Buffer Gets    Executions  Gets per Exec  %Total Time (s)  Time (s) Hash Value
         21,286,248    2,632,793            8.1    3.4   666.73    666.76 3610154549
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
         17,029,561    1,176,849           14.5    2.7   417.32    416.73 1909376826
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
         17,006,795           37      459,643.1    2.7   367.61    368.95 4045552861
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.userAnother Statspack report for the whole day shows;
    SQL ordered by CPU  DB/Inst: DB01/db01  Snaps: 14822-14847
    -> Total DB CPU (s):          82,134
    -> Captured SQL accounts for   40.9% of Total DB CPU
    -> SQL reported below exceeded  1.0% of Total DB CPU
        CPU                  CPU per             Elapsd                     Old
      Time (s)   Executions  Exec (s)  %Total   Time (s)    Buffer Gets  Hash Value
    tTime <= :3 ) AND (endTime IS NULL OR endTime >= :4 )
       2773.77    7,787,914       0.00    3.4    3739.61     112,671,645 1909376826
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
    SQL ordered by Gets  DB/Inst: DB01/db01  Snaps: 14822-14847
    -> End Buffer Gets Threshold:    100000 Total Buffer Gets:   1,416,456,340
    -> Captured SQL accounts for   55.8% of Total Buffer Gets
    -> SQL reported below exceeded  1.0% of Total Buffer Gets
                                                         CPU      Elapsd     Old
      Buffer Gets    Executions  Gets per Exec  %Total Time (s)  Time (s) Hash Value
         86,354,963    7,834,326           11.0    6.3  2557.34   2604.08  906944860
    Module: JDBC Thin Client
    SELECT d.devId, d.vendor, d.model, d.productClass, d.oui, d.pare
    ntDeviceId, d.created, d.lastModified AS devLastMod, d.customerI
    d, d.userKey1, d.userKey2, d.userKey4, d.userKey5, d.firmwareFam
    ily, d.softwareVer, d.serialNum, d.ip, d.mac, d.userKey3, d.user
    .....BR,
    Diego
    Edited by: 899660 on 27-ene-2012 7:43
    Edited by: 899660 on 27-ene-2012 7:45

  • How can I get the elapse time for execution of a Query for a session

    Hi ,
    How can I get the elapse time for execution of a Query for a session?
    Example - I have a report based on the procedure ,when the user execute that it takes say 3 min. to return rows.
    Is there any possible way to capture this session info. for this particular execution of query along with it's execution elapse time?
    Thanks in advance.

    Hi
    You can use the dbms_utility.get_time tool (gives binary_integer type value).
    1/ Initialize you time and date of beginning :
    v_beginTime := dbms_utility.get_time ;
    2/ Run you procedure...
    3/ Get end-time with :
    v_endTime := dbms_utility.get_time ;
    4/ Thus, calculate elapsed time by difference :
    v_elapsTime := v_endTime - v_beginTime ;
    This will give you time elapsed in of 100th of seconds...
    Then you can format you result to give correct print time.
    Hope it will help you.
    AL

  • How to get elapsed time of the query in form 6i

    hi
    I used to use " set timing on " in sql to get the elapsed time
    set timing on
    elapsed time :XX:XX:XX ,
    but i dont know how to get it in fom
    its really imporant to measure the time elapsed for me cuz i am student an need to get the time
    thanx alot

    regarding to point 1 : u know there are three modes for system ; query, enter_qeury,and normal. when the system is not noraml so it is either query or enter_query , and both are query processing ( as i think) so it the elapsed time . it also by using timer stpos when system finish query ( normal)
    why you dont prefer timers ..... ( it important please to explain )
    thank you very much Navnit Punj
    Edited by: user8652693 on 22/07/2009 07:33 ص

  • Query Execution/Elapsed Time and Oracle Data Blocks

    Hi,
    I have created 3 tables with one column only. As an example Table 1 below:
    SQL> create table T1 ( x char(2000));
    So 3 tables are created in this way i.e. T1,T2 and T3.
    T1 = in the default database tablespace of 8k (11g v11.1.0.6.0 - Production) (O.S=Windows).
    T2 = I created in a Tablespace with Blocksize 16k.
    T3 = I created in a Tablespace with Blocksize 4k. In the same Instance.
    Each table has approx. 500 rows (So, table sizes are same in all the cases to test Query execution time ). As these 3 tables are created under different data block sizes so the ALLOCATED no. of data blocks are different in all cases.
    T1  =   8k  = 256 Blocks =  00:00:04.76 (query execution time/elapsed time)
    T2  = 16k=121 Blocks =  00:00:04.64
    T3 =   4k =  490 Blocks =  00:00:04.91
    Table Access is FULL i.e. I have used select * from table_name; in all 3 cases. No Index nothing.
    My Question is why query execution time is nearly the same in all 3 cases because Oracle has to read all the data blocks in each case to fetch the records and there is a much difference in the allocated no. of blocks ???
    In 4k block size example, Oracle has to read just 121 blocks and it's taking nearly the same time as it's taking to read 490 blocks???
    This is just 1 example of different data blocks. I have around 40 tables in each block size tablespace and the result are nearly the same. It's very strange for me because there is a much difference in the no. of allocated blocks but execution time is almost the same, only difference in milliseconds.
    I'll highly appreciate the expert opinions.
    Bundle of thanks in advance.
    Best Regards,

    Hi Chris,
    No I'm not using separate databases, it's 8k database with non-standard blocksizes of 16k and 4k.
    Actually I wanted to test the Elapsed time of these 3 tables, so for that I tried to create the same size
    tables.
    And how I equalize these is like I have created one column table with char(2000).
    555 MB is the figure I wanted to use for these 3 tables ( no special figure, just to make it bigger than the
    RAM used for my db at the db startup to be sure of not retrieving the records from cache).
    so row size with overhead is 2006 * 290,000 rows = 581740000(bytes) / 1024 = 568105KB / 1024 = 555MB.
    Through this math calculation I thought It will be the total table size. So I Created the same no. of rows in 3 blocksizes.
    If it's wrong then what a mes because I was calculating tables sizes in the same way from the last few months.
    Can you please explain a little how you found out the tables sizes in different block sizes.Though I understood how you
    calculated size in MB from these 3 block sizes
    T8K =97177 BLOCKS=759MB *( 97177*8 = 777416KB / 1024 = 759MB )*
    T16K=41639 BLOCKS=650MB
    BT4K=293656 BLOCKS=1147MB
    For me it's new to calculate the size of a table. Can you please tell me then how many rows I can create in each of
    these 3 tables to make them equal in MB to test for elapsed time.
    Then I'll again run my test and put the results here. Because If I've wrongly calculated table sizes then there is no need to talk about elapsed time. First I must equalize the table sizes properly.
    SQL> select sum(bytes)/1024/1024 "Size in MB" from dba_segments> 2 where segment_name = 'T16K';
    Size in MB
    655
    Is above SQL is correct to calculate the size or is it the correct alternative way to your method of calculating the size??
    I created the same table again with everything same and the result is :
    SQL> select num_rows,blocks from user_tables where table_name = 'T16K';NUM_ROWS BLOCKS
    290000 41703
    64 more blocks are allocated this time so may be that's y it's showing total size of 655 instead of 650.
    Thanks alot for your help.
    Best Regards,
    KAm
    Edited by: kam555 on Nov 20, 2009 5:57 PM

  • Execution time, elapsed time  of an sql query

    Can you please tell me how to get the execution time, elapsed time of an sql query

    user8680248 wrote:
    I am running query in the database
    I would like to know how long the query take the time to completeWhy? That answer can be totally meaningless as the VERY SAME query on the VERY SAME data on the VERY SAME database in the VERY SAME Oracle session can and will show DIFFERENT execution times.
    So why do you want to know a specific query's execution time? What do you expect that to tell you?
    If you mean that you want to know how long an existing query being executed is still going to take - that's usually quite difficult to determine. Oracle does provide a view on so-called long operations. However, only certain factors of a query's execution will trigger that this query is a long operation - and only for those specific queries will there be long operation stats that provide an estimated completion time.
    If your slow and long running query does not show in long operation, then Oracle does not consider it a long operation - it fails to meet the specific criteria and factors required as a long operation. This is not a bug or an error. Simply that your query does not meet the basic requirements to be viewed as a long operation.
    Oracle however provides the developer with the means to create long operations (using PL/SQL). You need to know and do the following:
    a) need to know how many units of work to do (e.g. how many fetches/loop iterations/rows your code will process)
    b) need to know how many units of work thus far done
    c) use the DBMS_APPLICATION_INFO package to create a long operation and continually update the operation with the number of work units thus far done
    It is pretty easy to implement this in PL/SQL processing code (assuming requirements a and b can be met) - and provide long operation stats and estimated completion time for the DBA/operators/users of the database, waiting on your process to complete.

  • Query Execution time - Elapsed time v Actual time taken

    Hi All,
    I have this scenario where I am querying a single table with the following results. It is a very heavy query in that there are multiple aggregate functions and multiple unions on it. Even if the query is written poorly (i doubt it is) why would the actual
    time taken to execute the query be much more than the statistics provided through the following commands?
    SET STATISTICS IO ON;
    SET STATISTICS TIME ON;
    Attached are the stats provided for the relevant query in question.
    Table '123456789_TEMP_DATA'. Scan count 178, logical reads 582048, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.
    SQL Server Execution Times:
       CPU time = 936 ms,  elapsed time = 967 ms.
    2014-01-06 17:36:41.383
    Now, although the CPU Time/Elapsed time shows that it takes less than a second, it actually takes more than 15 seconds to fetch the results. (This is the actual time that you get on the bottom bar of the Query pane as well.)
    What is the reason? Why is it that there is such a big discrepancy between the numbers? How can I improve this situation?
    Thanks!

    Yes. I am returning a huge number of rows to the client. 
    The query is simply against a single table. 
    Select
     'First Record',AVG(COLUMN1),STDEV(COLUMN1
    ),COUNT(COLUMN1)
    FROM [TABLE1] WHERE (SOME CONDITION)
    UNION ALL
    Select  'Second Record',AVG(COLUMN2),STDEV(COLUMN2),COUNT(COLUMN2) FROM [TABLE1]
    WHERE (SOME OTHER CONDITION)
    Imagine there are 178 records fetched in this manner with 178 UNIONs. The WHERE clause will always change for each SELECT statement.
    Now, the question is not so much about the query itself, but why the execution time is actually 15 seconds whilst the SQL STATISTICS show it to be 936ms (<1 second)
    Thanks!

  • How to reduce the elapsed time on this query.

    Oracle10.2.0.5 on AIX6.1.
    Here is the awrsql report of a query for a one hour window.
    Here UNBILLED has 120million records which is partitioned and subpartitioned. It has 10 partitions and 312 subpartitions. One subpartition has 10M records, 10 others have 1M each and 270 subpartitions have 360K records each. And 31 subpartitions are empty.
    And BILLED has 300K records.
    Looking at report you can see that out of 984 seconds, 958 is used for IO. Machine is PowerPC_POWER5 with 8CPU and disk storage on EMC.
    Stat Name                                Statement   Per Execution % Snap
    Elapsed Time (ms)                           984,327        5,561.2    28.6
    CPU Time (ms)                                40,760          230.3    29.8
    Executions                                      177            N/A     N/A
    Buffer Gets                               1,923,456       10,867.0    46.9
    Disk Reads                                  203,832        1,151.6    25.1
    Parse Calls                                       0            0.0     0.0
    Rows                                        106,200          600.0     N/A
    User I/O Wait Time (ms)                     958,766            N/A     N/A
    Cluster Wait Time (ms)                            0            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                        0            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     1            N/A     N/A
    Sharable Mem(KB)                                 31            N/A     N/A
    SQL_ID akg45a750sh0u
    DELETE UNBILLED WHERE (MSG_ID, MSG_ID2,SPLIT_ROW_NUM) IN (SELECT MSG_ID,MSG_ID2, SPLIT_ROW_NUM FROM BILLED
    WHERE BILL_REF_NO = :B2 AND BILL_REF_RESETS = :B1 )
    Plan hash value: 3879210699
    | Id  | Operation                            | Name                          | Rows  | Bytes | Cost (%CPU)| Pstart| Pstop |
    |   0 | DELETE STATEMENT                     |                               |       |       |     1 (100)|       |       |
    |   1 |  DELETE                              | UNBILLED                      |       |       |            |       |       |
    |   2 |   NESTED LOOPS                       |                               |     1 |   112 |     0   (0)|       |       |
    |   3 |    TABLE ACCESS BY GLOBAL INDEX ROWID| BILLED                        |     1 |    65 |     0   (0)|     1 |     1 |
    |   4 |     INDEX RANGE SCAN                 | BILLED_XCB_BILL_REF_TRANS     |     1 |       |     0   (0)|       |       |
    |   5 |    INDEX UNIQUE SCAN                 | UNBILLED_PK                   |     1 |    47 |     0   (0)|       |       |
    ----------------------------------------------------------------------------------------------------------------------Is there way to improve the elapsed time( currently 5,561.2 msec per execution) of the query?
    Thanks for your time...

    user1014212 wrote:
    You're giving very interresting pointers.. Especially the one using the GTT table... Thanks...
    I was also looking from a DBA point of view, say increasing the DB_CACHE_SIZE from 5GB to 8GB as the machine has almost 32GB memory out of which 13GB is free memory. Because the timed event is "db file sequential read" which takes 95% of Total Call time.
    select * from V_$SGA_TARGET_ADVICE;
    post SQL & FORMATTED results using tags                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Again..What elapse time you are expecting for this query..

    Hi Again want to confirm with you Oracle gurus ...
    Does following plsql code really takes time in mins
    I do not used to deal with clob data so can not say why there is so delay..
    -> TableA has 3000 rows with text_data clob column holding large clob data...
    -> TableB has some thing which i wnat to append in text_data column..
    -> Trying to minimize elapse time..
    declare
    cursor c1 is select object_id from TableA where object_type = 'STDTEXT' and rownum < 1000;
    TYPE v_object_id_t is table of TableA.object_id%type index by binary_integer;
    v_object_id v_object_id_t;
    cursor c2(p_object_id TableA.object_id%type) is
    select to_clob('<IMG "MFI_7579(@CONTROL=' || ref_id || ',REF_ID=' || ref_id || ').@UDV">' || substr('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx',1, round(to_char(systimestamp,'FF2')/2)-1)) temp_data
    from TableB where object_id = p_object_id;
    TYPE v_text_data_t is table of TableA.text_data%type index by binary_integer;
    v_text_data v_text_data_t;
    v_temp clob ;
    r2 c2%rowtype;
    begin
    open c1;
    loop
    FETCH c1 BULK COLLECT INTO v_object_id ;
    for i in 1..v_object_id.count loop
    dbms_lob.createtemporary(v_temp,TRUE);
    open c2(v_object_id(i));
    loop
    fetch c2 into r2;
    exit when c2%NOTFOUND;
    dbms_lob.append(v_temp,r2.temp_data);
    end loop;
    close c2;
    v_text_data(i) := '';
    v_text_data(i) := v_temp;
    -- DBMS_OUTPUT.PUT_LINE (length(v_text_data(i)));
    dbms_lob.freetemporary(v_temp);
    end loop;
    forall counter in 1..v_text_data.count
    update TableA
    set text_data = concat(text_data,v_text_data(counter))
    where object_id = v_object_id(counter);
    DBMS_OUTPUT.PUT_LINE ('Update performed!');
    commit;
    EXIT WHEN c1%NOTFOUND;
    end loop;
    close c1;
    exception
    when others then
    DBMS_OUTPUT.PUT_LINE ('Update not performed!');
    end;
    -- Last elapse time 333 sec for 8k text_data data if i use 16k block size
    -- Last elapse time 1503 sec for 2k text_data data if i use 8k block size
    ->> Am I going rigth way???
    Please Help...
    Cheers :)
    Rushang Kansara
    Message was edited by:
    Rushang Kansara
    Message was edited by:
    Rushang Kansara

    Here is an example that shows SQL and PL/SQL methods. Note that the DBMS_LOB.WriteAppend() call is the wrong call to use (as I did above. The correct call to use (for appending CLOB to a CLOB) is DBMS_LOB.Append() (as shown below).
    SQL> create table my_docs
    2 (
    3 doc_id number,
    4 doc CLOB
    5 )
    6 /
    Table created.
    SQL>
    SQL> create sequence id
    2 start with 1
    3 increment by 1
    4 nomaxvalue
    5 /
    Sequence created.
    SQL>
    SQL>
    SQL> create or replace procedure AddXML( rowCount number DEFAULT 1000 ) is
    2 cursor curXML is
    3 select
    4 XMLElement( "ORA_OBJECT",
    5 XMLForest(
    6 object_id as "ID",
    7 owner as "OWNER",
    8 object_type as "TYPE",
    9 object_name as "NAME"
    10 )
    11 ) as "XML_DATA"
    12 from all_objects
    13 where rownum <= rowCount;
    14
    15 tmpClob CLOB;
    16 xml XMLType;
    17 lineCount number := 0;
    18 docID number;
    19 begin
    20 DBMS_LOB.CreateTemporary( tmpClob, TRUE );
    21
    22 open curXML;
    23 loop
    24 fetch curXML into xml;
    25 exit when curXML%NOTFOUND;
    26
    27 lineCount := lineCount + 1;
    28
    29 DBMS_LOB.Append(
    30 tmpClob,
    31 xml.GetCLOBVal() -- add the XML CLOB to our temp CLOB
    32 );
    33 end loop;
    34 close curXML;
    35
    36 insert
    37 into my_docs
    38 ( doc_id, doc )
    39 values
    40 ( id.NextVal, tmpClob )
    41 returning doc_id into docID;
    42
    43 commit;
    44
    45 DBMS_LOB.FreeTemporary( tmpClob );
    46 DBMS_OUTPUT.put_line( lineCount||' XML object(s) were appended to document '||docID );
    47 end;
    48 /
    Procedure created.
    SQL> show errors
    No errors.
    SQL>
    SQL> -- add 3 CLOBs of varying sizes
    SQL> exec AddXML
    1000 XML object(s) were appended to document 1
    PL/SQL procedure successfully completed.
    SQL> exec AddXML(100)
    100 XML object(s) were appended to document 2
    PL/SQL procedure successfully completed.
    SQL> exec AddXML(500)
    500 XML object(s) were appended to document 3
    PL/SQL procedure successfully completed.
    SQL>
    SQL> -- what are the sizes of the CLOBs and the total size?
    SQL> select
    2 doc_id,
    3 SUM( ROUND( LENGTH(doc)/1024 ) ) as "KB_SIZE"
    4 from my_docs
    5 group by
    6 ROLLUP(doc_id)
    7 /
    DOC_ID KB_SIZE
    1 98
    2 9
    3 47
    154
    SQL>
    SQL> -- add an empty CLOB
    SQL> insert into my_docs values( 0, NULL );
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> -- note that the new CLOB is zero KB in size
    SQL> select
    2 doc_id,
    3 ROUND( LENGTH(doc)/1024 ) as "KB_SIZE"
    4 from my_docs
    5 /
    DOC_ID KB_SIZE
    1 98
    2 9
    3 47
    0
    SQL>
    SQL> -- we add document 1 to 3 to document 0 using SQL
    SQL> update my_docs
    2 set doc = doc || (select t.doc from my_docs t where t.doc_id = 1 )
    3 where doc_id = 0;
    1 row updated.
    SQL>
    SQL> update my_docs
    2 set doc = doc || (select t.doc from my_docs t where t.doc_id = 2 )
    3 where doc_id = 0;
    1 row updated.
    SQL>
    SQL>
    SQL> update my_docs
    2 set doc = doc || (select t.doc from my_docs t where t.doc_id = 3 )
    3 where doc_id = 0;
    1 row updated.
    SQL>
    SQL> commit;
    Commit complete.
    SQL>
    SQL> -- what are the sizes now?
    SQL> select
    2 doc_id,
    3 ROUND( LENGTH(doc)/1024 ) as "KB_SIZE"
    4 from my_docs
    5 /
    DOC_ID KB_SIZE
    1 98
    2 9
    3 47
    0 154
    SQL>
    SQL>
    SQL> -- we do the adds again, but time time using a PL/SQL procedure to do it
    SQL> declare
    2 cursor c is
    3 select doc from my_docs where doc_id in (1,2,3);
    4
    5 updateClob CLOB;
    6 appendClob CLOB;
    7 begin
    8 -- we must lock the row for update and then we can write directly
    9 -- to that row's CLOB locator (without using the UPDATE SQL statement)
    10 select
    11 doc into updateClob
    12 from my_docs
    13 where doc_id = 0
    14 for update;
    15
    16
    17 open c;
    18 loop
    19 fetch c into appendClob;
    20 exit when c%NOTFOUND;
    21
    22 -- we append the CLOBs to document 0
    23 DBMS_LOB.Append( updateClob, appendClob );
    24 end loop;
    25
    26 -- .. and commit the changes to document 0's CLOB locator
    27 commit;
    28 end;
    29 /
    PL/SQL procedure successfully completed.
    SQL>
    SQL>
    SQL> -- what are the sizes now?
    SQL> select
    2 doc_id,
    3 ROUND( LENGTH(doc)/1024 ) as "KB_SIZE"
    4 from my_docs
    5 /
    DOC_ID KB_SIZE
    1 98
    2 9
    3 47
    0 308
    SQL>

  • Direct Path Read waits are not showing in Elapsed time

    Hi,
    I'm having a question regarding interpretation of a SQL trace file. I'm on Oracle 11.2.0.1 HP/UX 64 bit.
    Following is only the overall result of the trace (it is quite big).
    My question is about the Direct Path Read waits which are totallizing 268s of wait but are not showing in the fetch elapsed time (49.58s) and are not showing anywhere in the trace except in the overall result.
    I do not understand why it is not part of the Elapsed time...
    For info, the trace is for the specific session that was performing all the required queries to display an online report. The database is accessed by the Java application using Hybernate.
    The trace was obtained by the following SQL:
    exec sys.dbms_monitor.serv_mod_act_trace_enable(service_name=>'SYS$USERS',waits=>true,binds=>true);Then I query the sessions to find the one created by the application.
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse       36      0.43       0.51          0          5          0           0
    Execute     62      0.01       0.01          0          0          0           0
    Fetch      579      4.01      49.06       3027     153553          0        5516
    total      677      4.45      49.58       3027     153558          0        5516
    Misses in library cache during parse: 29
    Misses in library cache during execute: 2
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                   32754        0.00          0.03
      SQL*Net message from client                 32753        2.33        232.01
      Disk file operations I/O                      179        0.00          0.02
      db file sequential read                      2979        0.54         45.72
      SQL*Net more data to client                133563        0.04          5.30
      direct path read                            34840        0.94        268.21
      SQL*Net more data from client                1075        0.00          0.02
      db file scattered read                          6        0.03          0.11
      asynch descriptor resize                       52        0.00          0.00
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse       25      0.00       0.02          0          0          0           0
    Execute     58      0.05       0.04          0          0          0           0
    Fetch      126      0.00       0.04          4        161          0         123
    total      209      0.05       0.11          4        161          0         123
    Misses in library cache during parse: 3
    Misses in library cache during execute: 3
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      Disk file operations I/O                        1        0.00          0.00
      db file sequential read                         4        0.01          0.03
      asynch descriptor resize                        1        0.00          0.00
       37  user  SQL statements in session.
       57  internal SQL statements in session.
       94  SQL statements in session.
    Trace file: oxd1ta00_ora_16542.trc
    Trace file compatibility: 11.1.0.7
    Sort options: default
           1  session in tracefile.
          37  user  SQL statements in trace file.
          57  internal SQL statements in trace file.
          94  SQL statements in trace file.
          57  unique SQL statements in trace file.
      241517  lines in trace file.
         568  elapsed seconds in trace file.Thanks
    Christophe

    Christophe Lize wrote:
    Closing this thread even if it's not answered...Sorry, I don't have time to test this myself now, but you shouldn't mark this thread as answered if it is not, because other people might find it and think they find an answer if they have a similar question.
    I suggest you try the following to narrow down things:
    1. Open the RAW trace file and check the cursor numbers of the "direct path reads" - check if you can find any references for those cursor numbers manually. The cursor numbers are those numbers behind the WAIT #<xx>, and you can check if you find any other entry unequal to WAIT #<xx> with the same #<xx>, for example EXEC #<xx> or FETCH #<xx>
    A short primer on how to interpret the raw trace file can also be found in MOS document 39817.1
    2. Run the RAW trace file through alternative free trace file analyzers like SQLDeveloper (yes it can process raw trace files), OraSRP or Christian Antognini's TVD$XTAT. If you have My Oracle Support access you can also try Oracle's own extended Trace Analyzer (TRCA / TRCANLZR). See MOS Note 224270.1
    Check if these tools tell you more about your specific wait event and oddities with the trace file in general.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    Co-author of the "OakTable Expert Oracle Practices" book:
    http://www.apress.com/book/view/1430226684
    http://www.amazon.com/Expert-Oracle-Practices-Database-Administration/dp/1430226684

  • Data Blocks and the Elapsed Time

    Hi,
    I have created 3 tables with one column only. As an example Table 1 below:
    SQL> create table T8k( x char(2000));
    So 3 tables are created in this way i.e. T8k,T16K and T4K
    T8 = in the default database tablespace of 8k (11g v11.1.0.6.0 - Production) (O.S=Windows).
    T16 = I created in a Tablespace with Blocksize 16k.
    T4K = I created in a Tablespace with Blocksize 4k. In the same Instance.
    Each table has 290,000 rows and all the 3 tables have equal size of 555MB (2006(rowsize with overhead) * 290,000/1024/1024 = 555MB) to test Elapsed Time (set timing on).
    As these 3 tables are created under different block sizes so the allocated no. of data blocks are different as below:
    T8K = 97177 BLOCKS= 00:41:20.21 (Elapsed Time)
    T16K=41639 BLOCKS= 00:44:11.59
    BT4K=293656 BLOCKS=00:37:29.06
    Please note the difference. First table i.e. 8k block size, allocated blocks are 97177 and taking around 41 mins. Third table i.e. BT4K (in a 4k block size tablespace), allocated blocks(293656 ) are almost 3 times bigger, taking around 37 mins to execute the query. I mean the difference is only 4 mins hardly and blocks difference is 3 times.
    In case of any doubt, I've created these tables bigger than the memory used for my db(memory_max_size 408M) i.e. 555 MB that If Blocks are already in cache then reading the blocks and counting the rows will nearly be the same regardless of the block sizes or the number of blocks.
    Need solid suggestions and if possilble, links also which has some serious discussions regarding my issue.
    Bundle of thanks.
    Best Regards,

    Because I was not completely satisfied with the things last time. It doesn't seem so simple to me as people said
    I thought may some guru have a look today, not just to point out that i have created it again.
    And I have compact my question to avoid confusion.

  • Oracle View that stores the Query execution time

    Hi Gurus
    i m using Oracle 10G in Unix. I wudiold like to know which Data dictionary view stores the execution of a query. If it is not stored then hw to find the query execution time other than (Set timing on) command. What is the use of elapsed time and what is the difference between execution time and elapsed time? How to calculate the execution time of a query.
    THanks
    Ram

    If you have a specific query you're going to run in SQL*Plus, just do
    a 'set timing on' before you execute the query.
    If you've got application SQL coming in from all over the place, you can
    identify specific SQL in V$SQL/ and look at ELAPSED_TIME/EXECUTIONS
    to get an average elapsed time.
    If you've got an application running SQL, and you need to know the
    specific timing of a specific execution (as opposed to an average),
    you can use DBMS_SUPPORT to set trace in the session that your
    application is running in, and then use TkProf to process the resulting
    trace file.

  • Cost in explain plan vs elapsed time

    hi gurus,
    i have two tables with identical data volume(same database/schema/tablespace) and the only difference between these two is, one partitioned on a date filed.
    statistics are up to date.
    same query is executed against both tables, no partition pruning involved.
    select ....... from non-partitioned
    execution plan cost=92
    elapsed time=117612
    select ... from partitioned
    execution plan cost=3606
    elapsed time=19559
    though plan cost of query against non-partitioned is quite less than partitioned, elapsed time in v$sqlarea is higher than partitioned.
    what could be the reason please?
    thanks,
    charles
    Edited by: user570138 on May 6, 2010 6:54 AM

    user570138 wrote:
    if elapsed time value is very volatile(with the difference in explain plan cost) , then how can i compare the performance of the query?Note that the same query with same execution plan and same data can provide different execution times - and due to a number of factors. The primary one being that the first time the query is executed, it performs physical I/O and loads the data into the buffer cache - where the same subsequent query finds this data via cheaper and faster logical I/O in the cache.
    in my case i want to compare the performance change before and after table partitioning.Then look at the actual utilisation cost of the query and not (variant) elapsed execution time. The most expensive operation on a db platform is typically I/O. The more I/O, the slower the execution time.
    I/O can be decreased in a number of ways. The usual approach in the database environment is to provide better or alternative data structures, in order to create more optimal I/O paths.
    So instead of using a hash table and separate PK b+tree index, using an index organised table. Instead of a single large table with indexes, a partitioned table with local indexes. Instead of joining plain tables, joining tables that have been clustered. Etc.
    In most cases, when done correctly, these physical data structure changes do not even impact the application layer. The SQL and code in this layer should be blissfully unaware of the physical structure changes done to improve performance.
    Likewise, changes in the logical layer (data model changes) can also improve performance. This of course does impact the application layer - and requires a proper design and implementation in the physical layer. Often proper data modeling is overlooked and flaws in it is attempted to be fixed by hacking the physical layer.
    my aim is to measure the query performance improvements, if any, by partitioning an existing tableWhy not measure current I/O before an operation, and then after the operation - and use the difference to determine the amount of I/O performed by that operation?
    This can be implemented in a start/stop watch fashion (instead of measuring time, measuring I/O) using the v$sesstat virtual performance view.

Maybe you are looking for

  • Remote app on multiple apple tv's??

    How can you use one ipad, iphone to control al your apple tv's (during an exhibition) so you don't have to switch between the diffrent apple tv's? They have to make the same movements like on every other screen! please help thanks.

  • Accessing the host component in a PDF navigator

    Hi all, I'm trying to access the host (i.e reader or acrobat) in a PDF navigator (Portfolio) created in flash builder. I have seen numerous examples that override the host set method by doing the following: public function set host(host:INavigatorHos

  • Elements 3 no longer works on iMac w/ OS 10.6.8 (Snow Leopard)

    As someone who only uses PhotoShop to make minor adjustments to digital pix, I have never felt the need to upgrade from Elements 3.  As of yesterday it worked perfectly.  Today when I try to Open a photo that command (and others) are grayed out on th

  • Alerts and Performanace

    In our current project, during the message mapping and through RWB Alert rules we generate alerts. During mapping we call SALRT_CREATE_LOCAL thrugh RFC mapping look-up API to create alerts . When there are more than 15 to 20 alerts created, all the D

  • Photoshop cc freezes when I open a certain psd file

    I am on Mac OS X 10.9 and working in CC While i was rescaling a vector layer in a psd doc in which I have been working all day, PS CC suddenly froze. And now PS freezes when reopening that doc. PS opens the doc but freezes before loading the layers I