Tool to find the execution plan of a SQL query

Hi,
I new to Oracle. I come from the SQL Server world.
I would like to know what tool(s) should I use to identify the execution plan for a SQL statement and to see if a query is missing indices.
Thanks,
Paul

Use SQL*PLUS.
SQL> select dummy from dual;
D
X
SQL> set autotrace on explain
SQL> r
  1* select dummy from dual
D
X
Execution Plan
   0      SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1 Bytes=2)
   1    0   TABLE ACCESS (FULL) OF 'DUAL' (TABLE) (Cost=2 Card=1 Bytes
          =2)
SQL> set autot off
SQL> explain plan for select dummy from dual;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 1157671242
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
8 rows selected.
SQL> disconnect
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining options
SQL>

Similar Messages

  • How i can find the execution plan

    how i can find the execution plan for a quesry , and how i can compare two execution plan

    Mohan,
    Just create a table as follows
    CREATE TABLE T1 (STATEMENT_ID VARCHAR2(30),TIMESTAMP DATE,OPERATION VARCHAR2(30),
              OPTIONS VARCHAR2(30),OBJECT_NAME VARCHAR2(30),COST NUMBER(38),
              ID NUMBER(38),PARENT_ID NUMBER(38), OBJECT_NODE VARCHAR2(128),
              OBJECT_OWNER VARCHAR2(30),OBJECT_INSTANCE NUMBER(38),OBJECT_TYPE VARCHAR2(30),
              OPTIMIZER VARCHAR2(255),SEARCH_COLUMNS NUMBER,POSITION NUMBER(38),
              PARTITION_START VARCHAR2(255),PARTITION_STOP VARCHAR2(255),PARTITION_ID NUMBER(38),
              CARDINALITY NUMBER(38),BYTES NUMBER(38),OTHER_TAG VARCHAR2(255),
              OTHER LONG,REMARKS VARCHAR2(80),DISTRIBUTION VARCHAR2(30)
    Now use the sql statements as
    > EXPLAIN PLAN INTO T1 FOR (SELECT * FROM EMP);
    > Select * from T1
    this should do the job . . .
    Regards,
    K.T. Gandhi Karuna

  • How to capture the execution plan for a query

    HI All,
    Can anyone please help me in finding out the command to capture the execution plan for a query.
    Execution plan for select * from EMP where <Condtions>
    it is getting executed successfully but i need to get the proper execution plan for the same.
    Thanks

    971830 wrote:
    i want to know where execution plan gets generated??
    in PMON of server process or in shared pool??
    i know that optimixer create execution plan..It is stored in Library Cache (present inside Shared Pool ).
    select * from v$sql_plan;An absolute beautiful white paper :
    Refer this -- www.sagelogix.com/sagelogix/SearchResults/SAGE015052
    Also -- http://www.toadworld.com/KNOWLEDGE/KnowledgeXpertforOracle/tabid/648/TopicID/XPVSP/Default.aspx
    HTH
    Ranit B.

  • How to find the execution time of a query?

    hi guys,
    i need to find the execution time of a query.
    i tried finding it in rsrt but couldn find the execution time.
    pleasse let me know the way to do it..
    regards
    sagar

    Hi sagar,
    If you want to know the frontend time, first of all you need to maitain the BW Statistics. To maintain you have to go the respective target and click on it. Go to the tools, select BW Statistics of infoprovider. It pop ups a window there you find two check boxes 1) WHM and 2) Front end time. Check both.
    Now Exe query and close the analyzer. Then go to SE11 table RSDDSTAT. There is one field which displays Frentend time.
    OR
    Go to STO3 here also you can analys the frontend time.
    If you feel useful Assign Pts.
    Regards,
    Vishal

  • Error in DAC 7.9.4 while building the execution plan

    I'm getting Java exception EXCEPTION CLASS::: java.lang.NullPointerException while building the execution plan. The parameters are properly generated.
    Earlier we used to get the error - No physical database mapping for the logical source was found for :DBConnection_OLAP as used in QUERY_INDEX_CREATION(DBConnection_OLAP->DBConnection_OLAP)
    EXCEPTION CLASS::: com.siebel.analytics.etl.execution.NoSuchDatabaseException
    We resolved this issue by using the in built connection parameters i.e. DBConnection_OLAP. This connection parameter has to be used because the execution plan cannot be built without OLAP connection.
    We are not using 7.9.4 OLAP data model since we have highly customized 7.8.3 OLAP model. We have imported 7.8.3 tables in DAC.
    We have created all the tasks with syncronzation method, created the task group and subject area. We are using in built DBConnection_OLAP and DBConnection_OLTP parameters and pointed them to relevant databases.
    system set up -
    OBI DAC server - windows server
    Informatica server and repository sever 7.1.4 - installed on local machine and
    provied PATH variables.
    IS this problem regarding the different versions i.e. we are using OBI DAC 7.9.4 and underlying data model is 7.8.3?
    Please help,
    Thanks and regards,
    Ashish

    Hi,
    Can anyone help me here as I have stuck with the following issue................?
    I have created a command task in workflow at Informatica that will execute a script in Unix to purge chache at OBIEE.But I want that workflow to be added as a task in DAC at already existing Plan and should be run at the last one whenever the Incremental load happens.
    I created a Task in DAC with name of Workflow like WF_AUTO_PURGE and added that task as following task at Execution mode,The problem here is,I want to build that task after adding to the plan.I some how stuck here , When I try to build the task It is giving following error !!!!!
    MESSAGE:::Error while loading pre post steps for Execution Plan. CompleteLoad_withDeleteNo physical database mapping for the logical source was found for :DBConnection_INFA as used in WF_AUTO_PURGE (DBConnection_INFA->DBConnection_INFA)
    EXCEPTION CLASS::: com.siebel.analytics.etl.execution.ExecutionPlanInitializationException
    com.siebel.analytics.etl.execution.ExecutionPlanDesigner.design(ExecutionPlanDesigner.java:1317)
    com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:169)
    com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:119)
    com.siebel.analytics.etl.client.view.table.EtlDefnTable.doOperation(EtlDefnTable.java:169)
    com.siebel.etl.gui.view.dialogs.WaitDialog.doOperation(WaitDialog.java:53)
    com.siebel.etl.gui.view.dialogs.WaitDialog$WorkerThread.run(WaitDialog.java:85)
    ::: CAUSE :::
    MESSAGE:::No physical database mapping for the logical source was found for :DBConnection_INFA as used in WF_AUTO_PURGE(DBConnection_INFA->DBConnection_INFA)
    EXCEPTION CLASS::: com.siebel.analytics.etl.execution.NoSuchDatabaseException
    com.siebel.analytics.etl.execution.ExecutionParameterHelper.substitute(ExecutionParameterHelper.java:208)
    com.siebel.analytics.etl.execution.ExecutionParameterHelper.parameterizeTask(ExecutionParameterHelper.java:139)
    com.siebel.analytics.etl.execution.ExecutionPlanDesigner.handlePrePostTasks(ExecutionPlanDesigner.java:949)
    com.siebel.analytics.etl.execution.ExecutionPlanDesigner.getExecutionPlanTasks(ExecutionPlanDesigner.java:790)
    com.siebel.analytics.etl.execution.ExecutionPlanDesigner.design(ExecutionPlanDesigner.java:1267)
    com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:169)
    com.siebel.analytics.etl.client.util.tables.DefnBuildHelper.calculate(DefnBuildHelper.java:119)
    com.siebel.analytics.etl.client.view.table.EtlDefnTable.doOperation(EtlDefnTable.java:169)
    com.siebel.etl.gui.view.dialogs.WaitDialog.doOperation(WaitDialog.java:53)
    com.siebel.etl.gui.view.dialogs.WaitDialog$WorkerThread.run(WaitDialog.java:85)
    Regards,
    Arul
    Edited by: 869389 on Jun 30, 2011 11:02 PM
    Edited by: 869389 on Jul 1, 2011 2:00 AM

  • Unable to get the execution plan when using dbms_sqltune (11gR2)

    Hi,
    Database version: 11gR2
    I have a user A that is granted privileges to execute dbms_sqltune.
    I can create a task, excute it and run the report.
    But, when I run the report I get the following error:
    SQL> show user
    USER is "A"
    SQL> set long 10000 longchunksize 10000 linesize 200 pagesize 000
    select dbms_sqltune.report_tuning_task(task_name => 'MYTEST') from dual;SQL>
    GENERAL INFORMATION SECTION
    Tuning Task Name : MYTEST
    Tuning Task Owner : A
    Workload Type : Single SQL Statement
    Scope : COMPREHENSIVE
    Time Limit(seconds): 1800
    Completion Status : COMPLETED
    Started at : 05/15/2013 11:53:22
    Completed at : 05/15/2013 11:53:23
    Schema Name: SYSMAN
    SQL ID : gjm43un5cy843
    SQL Text : SELECT SUM(USED), SUM(TOTAL) FROM (SELECT /*+ ORDERED */
    SUM(D.BYTES)/(1024*1024)-MAX(S.BYTES) USED,
    SUM(D.BYTES)/(1024*1024) TOTAL FROM (SELECT TABLESPACE_NAME,
    SUM(BYTES)/(1024*1024) BYTES FROM (SELECT /*+ ORDERED USE_NL(obj
    tab) */ DISTINCT TS.NAME FROM SYS.OBJ$ OBJ, SYS.TAB$ TAB,
    SYS.TS$ TS WHERE OBJ.OWNER# = USERENV('SCHEMAID') AND OBJ.OBJ# =
    TAB.OBJ# AND TAB.TS# = TS.TS# AND BITAND(TAB.PROPERTY,1) = 0 AND
    BITAND(TAB.PROPERTY,4194400) = 0) TN, DBA_FREE_SPACE SP WHERE
    SP.TABLESPACE_NAME = TN.NAME GROUP BY SP.TABLESPACE_NAME) S,
    DBA_DATA_FILES D WHERE D.TABLESPACE_NAME = S.TABLESPACE_NAME
    GROUP BY D.TABLESPACE_NAME)
    ERRORS SECTION
    - ORA-00942: table or view does not exist
    SQL>
    It seems there a missing privileg for dislaying the execution plan.
    As a workaround, this is solved by granting select any dictionay (which I don't want) to the user A.
    Does someone have an idea about what privilege is missing?
    Kind Regards.

    Hi,
    SELECT ANY DICTIONARY system privilege provides access to SYS schema objects only => which you are using as workaround
    SELECT_CATALOG_ROLE provides access to all SYS views only.==> Safe option
    SQL> grant SELECT ANY DICTIONARY to test;
    Grant succeeded.
    SQL> conn test/test
    Connected.
    SQL> select count(*) from  sys.obj$;
      COUNT(*)
         13284
    SQL> conn /as sysdba
    Connected.
    SQL> revoke SELECT ANY DICTIONARY from test;
    Revoke succeeded.
    SQL> grant SELECT_CATALOG_ROLE to test;
    Grant succeeded.
    SQL> conn test/test
    Connected.
    SQL> select count(*) from  sys.obj$;
    select count(*) from  sys.obj$
    ERROR at line 1:
    ORA-00942: table or view does not existHTH

  • Tkprof not showing the Execution Plan for Statement

    Hi all
    using oracle 9i release 2
    I have issued the following statements
    alter session set sql_trace
    alter session set events '10046 trace name context forever, level 12';
    --then executed a pl-sql procedure
    after reading the traceout outfile it shows the Execution plan for statements directly wirtten under begin and end block and doesnot displays the plan for the statements written like this
    procedure a is
    cursor b is
    select ename,dname from dept a,emp b
    where a.deptno=b.deptno;
    begin
    for x in a loop --plan not found but stats are written
    select ename into v_ename from emp where empno=300; --does show the plan+stats
    end;
    what I am missing to get the actual plan in trace output file
    thanks in advance

    You have to exit sql*plus after running the procedure, example tkprof is below:
    declare
    cursor c is
    select ename, dname
    from emp, dept
    where emp.deptno = dept.deptno;
    begin
    for v_x in c
    loop
    dbms_output.put_line(v_x.ename || ' ' ||v_x.dname);
    end loop;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.06 0 0 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.06 0 0 0 1
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: 68
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.00 0.00
    SELECT ENAME, DNAME
    FROM
    EMP, DEPT WHERE EMP.DEPTNO = DEPT.DEPTNO
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 15 0.01 0.00 0 44 0 14
    total 17 0.01 0.00 0 44 0 14
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: 68 (recursive depth: 1)
    Rows Row Source Operation
    14 NESTED LOOPS
    14 TABLE ACCESS FULL EMP
    14 TABLE ACCESS BY INDEX ROWID DEPT
    14 INDEX UNIQUE SCAN DEPT_PK (object id 40350)
    Best Regards
    Krystian Zieja / mob

  • Can the format of a SQL Statement modify the execution time of an SQL ....

    Can the format of a SQL Statement modify the execution time of an SQL statement?
    Thanks in advance

    It depends on:
    1) What oracle version are you using
    2) What do you mean for "format"
    For example: if you're on Oracle9i and changing format means changing the order of the tables in the FROM clause and you're using Rule Based Optimizer then the execution plan and the execution time can be very different...
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2009/12/29/estrarre-i-dati-in-formato-xml-da-sql/]

  • How to find out the execution time of a sql inside a function

    Hi All,
    I am writing one function. There is only one IN parameter. In that parameter, i will pass one SQL select statement. And I want the function to return the exact execution time of that SQL statement.
    CREATE OR REPLACE FUNCTION function_name (p_sql IN VARCHAR2)
    RETURN NUMBER
    IS
    exec_time NUMBER;
    BEGIN
    --Calculate the execution time for the incoming sql statement.
    RETURN exec_time;
    END function_name;
    /

    Please note that wrapping query in a "SELECT COUNT(*) FROM (<query>)" doesn't necessarily reflect the execution time of the stand-alone query because the optimizer is smart and might choose a completely different execution plan for that query.
    A simple test case shows the potential difference of work performed by the database:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Session altered.
    SQL>
    SQL> drop table count_test purge;
    Table dropped.
    Elapsed: 00:00:00.17
    SQL>
    SQL> create table count_test as select * from all_objects;
    Table created.
    Elapsed: 00:00:02.56
    SQL>
    SQL> alter table count_test add constraint pk_count_test primary key (object_id)
    Table altered.
    Elapsed: 00:00:00.04
    SQL>
    SQL> exec dbms_stats.gather_table_stats(ownname=>null, tabname=>'COUNT_TEST')
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.29
    SQL>
    SQL> set autotrace traceonly
    SQL>
    SQL> select * from count_test;
    5326 rows selected.
    Elapsed: 00:00:00.10
    Execution Plan
    Plan hash value: 3690877688
    | Id  | Operation         | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT  |            |  5326 |   431K|    23   (5)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| COUNT_TEST |  5326 |   431K|    23   (5)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
            419  consistent gets
              0  physical reads
              0  redo size
         242637  bytes sent via SQL*Net to client
           4285  bytes received via SQL*Net from client
            357  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
           5326  rows processed
    SQL>
    SQL> select count(*) from (select * from count_test);
    Elapsed: 00:00:00.00
    Execution Plan
    Plan hash value: 572193338
    | Id  | Operation             | Name          | Rows  | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |               |     1 |     5   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE       |               |     1 |            |          |
    |   2 |   INDEX FAST FULL SCAN| PK_COUNT_TEST |  5326 |     5   (0)| 00:00:01 |
    Statistics
              1  recursive calls
              0  db block gets
             16  consistent gets
              0  physical reads
              0  redo size
            412  bytes sent via SQL*Net to client
            380  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL>As you can see the number of blocks processed (consistent gets) is quite different. You need to actually fetch all records, e.g. using a PL/SQL block on the server to find out how long it takes to process the query, but that's not that easy if you want to have an arbitrary query string as input.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle:
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Issue in  pulling  the execution plan from awrsqrpt report.

    Hi All,
    In my production database , recently we faced some performance issue in daily job and i like to pull the old execution plan of that particular job from awrsqrpt.sql report but i got below error.
    Interesting information is i can able to generate the addm reports & awr reports between the same SNAP id's Why not AWRSQRPT report ???.
    Version : Oracle 11gR2
    Error :
    +++++++++
    Specify the SQL Id
    ~~~~~~~~~~~~~~~~~~
    Enter value for sql_id: b9shw6uakgbdt
    SQL ID specified: b9shw6uakgbdt
    declare
    ERROR at line 1:
    ORA-20025: SQL ID b9shw6uakgbdt does not exist for this database/instance
    ORA-06512: at line 22
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    Old history of SQL id :
    ++++++++++++++++++++
    SQL> select distinct SNAP_ID,SESSION_ID,SESSION_SERIAL#,USER_ID, SQL_EXEC_START from dba_hist_active_sess_history where sql_id='b9shw6uakgbdt' order by SQL_EXEC_START;
    SNAP_ID SESSION_ID SESSION_SERIAL# USER_ID SQL_EXEC_
    13095 1026 23869 86 29-AUG-12
    13096 1026 23869 86 29-AUG-12
    13118 582 14603 95 30-AUG-12
    13119 582 14603 95 30-AUG-12
    13139 708 51763 95 30-AUG-12
    13140 708 51763 95 30-AUG-12
    13142 900 2897 86 31-AUG-12
    13143 900 2897 86 31-AUG-12
    13215 1285 62559 86 03-SEP-12
    13216 1285 62559 86 03-SEP-12
    13238 1283 9057 86 04-SEP-12
    13239 1283 9057 86 04-SEP-12
    Thanks

    Hi,
    Are you using a cluster database (RAC), and running this report on the wrong instance?
    This report validates the SQL ID you specify against the dba_hist_sqlstat view, so check there if you have that SQL ID:
    select dbid, instance_number, snap_id
    from dba_hist_sqlstat
    where sql_id='b9shw6uakgbdt';Regards.
    Nelson

  • Performance Tuning -To find the execution time for Select Statement

    Hi,
    There is a program that takes 10 hrs to execute. I need tune its performance. The program is basically reading few tables like KNA1,ANLA,ANLU,ADRC etc and updates to Custom table. I did my analysis and found few performance techniques for ABAP coding.
    Now my problem is, to get this object approved I need to submit the execution statistics to client.I checked both ST05 and SE30. I heard of a Tcode where we can execute a select statement and note its time, then modify and find its improved Performance. Can anybody suggest me on this.
    Thanks,
    Rajani.

    Hi,
    This is documentation regarding performance analysis. Hope this will be useful
    It is a general practice to use           Select  *  from <database>…     This statement populates all the values of the structure in the database.
    The effect is many fold:-
    •     It increases the time to retrieve data from database
    •     There is large amount of unused data in memory
    •     It increases the processing time from work area or internal tables
    It is always a good practice to retrieve only the required fields. Always use the syntax      Select f1  f2  …  fn  from <database>…      
    e.g.     Do not use the following statement:-
         Data: i_mara like mara occurs 0 with header line.
         Data: i_marc like marc occurs 0 with header line.
         Select * from mara
              Into table i_mara
              Where matnr in s_matnr.
         Select * from marc
              Into table i_marc
              For all entries in i_mara
              Where matnr eq i_mara-matnr.
         Instead use the following statement:-
                                       Data: begin of i_mara occurs 0,
                                            Matnr like mara-matnr,
                                                  End of i_mara.
         Data: begin of i_marc occurs 0,
              Matnr like marc-matnr,
                                            Werks like marc-werks,
                                                 End of i_marc.
         Select matnr from mara
              Into table i_mara
              Where matnr in s_matnr.

  • What's the execution plan tell me?

    Hey everyone,
    I'm just looking at this execution plan and want to understand what it exactly tells me.. I could make a little sense of it. I would like someone to explain it to me please.
    Here it is:
    Predicate Information (identified by operation id):
    4 - access("A"."ATHLETEID"="ATHLETEID")
    5 - filter("CCODE"='AUS')
    Note
    - dynamic sampling used for this statement (level=2)
    Statistics
    32 recursive calls
    0 db block gets
    26289 consistent gets
    0 physical reads
    5664 redo size
    23496 bytes sent via SQL*Net to client
    936 bytes received via SQL*Net from client
    49 SQL*Net roundtrips to/from client
    2 sorts (memory)
    0 sorts (disk)
    717 rows processed ---> it has selected 717 tuples.
    I know the last one but not the rest. Looking forward to a detailed answer on this.

    >
    I'm just looking at this execution plan and want to understand what it exactly tells me.. I could make a little sense of it. I would like someone to explain it to me please.
    >
    Well you are the ONLY one looking at the plan because you didn't post it for us to look at.
    Can't comment on something we can't see.

  • The execution plan

    I get two execution plans in the following:
    a.
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=35262
    1 0 SORT (AGGREGATE)
    2 1 BITMAP CONVERSION (COUNT)
    3 2 BITMAP INDEX (SINGLE VALUE) OF 'IDXWIPCURRENTFLG'
    b.
    Execution Plan
    0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=17629
    8)
    1 0 SORT (AGGREGATE)
    2 1 BITMAP CONVERSION (COUNT)
    3 2 BITMAP INDEX (RANGE SCAN) OF 'IDXWIPCURRENTFLG'
    How to understand 'Cost' and 'Card'?
    Which execution is more efficient?

    Hi,
    Card means Cardinality.
    The Cost is a mesure that have no unity but be sure that an explain plan with a lower cost means that the SQL statement will be quicker.
    Fred

  • How to find the execution time

    Hi
    I don't know whether it is possible in Oracle or not?
    Say i have got around 20 odd Views in my DB and couple of them based on Materialized View which is again created by joining more than 5 based tables.
    Even most of the Views are also created by joining base tables and MV's.
    When i execute Select count(*) from <viewname>;
    I do get the count of rows and on avg each view returns more that 30lacs row.
    And when i excute select * from <View_name> by setting the Time on.
    It takes more than 2 hours to return the rows.I know the elapsed time of a query do depend of external factors as well such as number of users using the DB Object used in thoe views,Number of process involved and all.
    And therefore in order to gather the elapsed time of each and every view will take more than a week .
    I would appreciate if anyone can provide me a better approach or even a shell script or something like that which will give me the elapsed time of all the views if i query (Select * from <view_name>);
    Thanks in advance.
    Vineet

    But to SomeoneElse's point, if you are running
    SELECT * FROM view_namefrom SQL*Plus, what you are primarily measuring is how fast your network is (because you're spending a great deal of time sending data from the database to the client) and the speed of the SQL*Plus client on your machine (which has to fetch that data, which may have to format and display that data, etc.) It is not a particularly meaningful metric. If you tuned the client machine so that SQL*Plus wasn't displaying the data, if you increased the fetch size, etc. you could drastically decrease the time it would take to send all the data to your client machine, but that is probably not going to constitute tuning for anyone other than you (i.e. you might see a halving of run time while everyone else saw no change).
    Beyond that, doing a SELECT * with no criteria is likely to involve execution plans that no one else will see, data access patterns no one else will see, etc. which just makes the benchmark you are proposing irrelevent.
    If you really, really want to measure how quickly your client can pull the data from all the views, you could of course let that run for a week. But the number wouldn't mean anything.
    Justin

  • How to find the Execution Time for Java Code?

    * Hi everyone , i want to calculate the execution time for my process in java
    * The following was the ouput for my coding,
    O/P:-
    This run took 0 Hours ;1.31 Minutes ;78.36 Seconds
    *** In the above output , the output should come exactly what hours , minutes and seconds for my process,
    but in my code the minutes are converted into seconds(It should not)...
    * Here is my coding,
        static long start_time;
        public static void startTime()
            start_time = System.currentTimeMillis();
        public static void endTime()
            DecimalFormat df = new DecimalFormat("##.##");
            long end_time = System.currentTimeMillis();
            float t = end_time - start_time;
            float sec = t / 1000;
            float min = 0, hr = 0;
            if (sec > 60) {
                min = sec / 60;
            if (min > 60) {
                hr = min / 60;
            System.out.println("This run took " + df.format(hr) + " Hours ;"+ df.format(min) + " Minutes ;" + df.format(sec) + " Seconds");
        }* How to Calcualte exact timing for my process....
    * Thanks

    * Hi flounder, Is following code will wotk perfectly?
         public static void endTime()
              DecimalFormat df = new DecimalFormat("##.##");
              long end_time = System.currentTimeMillis();
              float t = end_time - start_time;
              float sec = t / 1000;
              float min = 0, hr = 0;
              while(sec >= 60){
         min++;
         sec = sec -60;
         if (min >= 60){
         min = 0; //or min = min -60;
         hr++;
              System.out.println("This run took " + df.format(hr) + " Hours ;"+ df.format(min) + " Minutes ;" + df.format(sec) + " Seconds");
         }

Maybe you are looking for