How to get min,max,avg time for query execution?

Dear Friends,
In AWR we are getting avg time taken to execute particular query, how can one get min,max time taken by query during number of executions.
Thanks

I would run the sql in a cursor for loop, to get a quite reasonable execution time without changing the actual execution plan:
SQL> show user;
USER is "HR"
SQL> set timing on
SQL> select count(*) from all_objects;
  COUNT(*)
     55565
Elapsed: 00:00:03.91
SQL> var p_sql varchar2(200)
SQL> exec :p_sql := 'select * from all_objects'
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> declare
  2  t1 timestamp := systimestamp;
  3  begin
  4    execute immediate 'begin for c in (' || :p_sql || ') loop null; end loop; end;';
  5    dbms_output.put_line('Elapsed: ' || (systimestamp - t1));
  6  end;
  7  /
PL/SQL procedure successfully completed.
Elapsed: 00:00:03.53
SQL> declare
  2  t1 timestamp := systimestamp;
  3  begin
  4    execute immediate 'begin for c in (' || :p_sql || ') loop null; end loop; end;';
  5    dbms_output.put_line('Elapsed: ' || (systimestamp - t1));
  6  end;
  7  /
PL/SQL procedure successfully completed.
Elapsed: 00:00:02.75
SQL> declare
  2  t1 timestamp := systimestamp;
  3  begin
  4    execute immediate 'begin for c in (' || :p_sql || ') loop null; end loop; end;';
  5    dbms_output.put_line('Elapsed: ' || (systimestamp - t1));
  6  end;
  7  /
PL/SQL procedure successfully completed.
Elapsed: 00:00:02.73
SQL> declare
  2  t1 timestamp := systimestamp;
  3  begin
  4    execute immediate 'begin for c in (' || :p_sql || ') loop null; end loop; end;';
  5    dbms_output.put_line('Elapsed: ' || (systimestamp - t1));
  6  end;
  7  /
PL/SQL procedure successfully completed.
Elapsed: 00:00:02.66
SQL> ---- alter system flush shared_pool;
SQL> declare
  2  t1 timestamp := systimestamp;
  3  begin
  4    execute immediate 'begin for c in (' || :p_sql || ') loop null; end loop; end;';
  5    dbms_output.put_line('Elapsed: ' || (systimestamp - t1));
  6  end;
  7  /
PL/SQL procedure successfully completed.
Elapsed: 00:00:02.80
SQL> declare
  2  t1 timestamp := systimestamp;
  3  begin
  4    execute immediate 'begin for c in (' || :p_sql || ') loop null; end loop; end;';
  5    dbms_output.put_line('Elapsed: ' || (systimestamp - t1));
  6  end;
  7  /
PL/SQL procedure successfully completed.
Elapsed: 00:00:02.64
SQL>
https://forums.oracle.com/thread/705536?start=15&tstart=0
Regards
Girish Sharma

Similar Messages

  • How to get min/max price to be captured from last 6months

    Hi friends,
    I'm confusing about my report requirements can anybody suggest about the below comments.
    1) I want to generate report min/max price to be captured for last 6months based on query selection given values e.g: material, calmonth.
    2. Query date/Query month is based on Purchase order creation date.
    3. When we execute query for given 0material, 0calmonth e.g: 10000 , 12.2008 report output should be last six months min/max price for materials.
    How can i get this type of report.
    Anybody suggest me on this.
    Thanks lot
    Siri

    Dear Siri,
    I understand that your report should be like:
    Material     CalMonth    Min Price    Max Price
    Have you explored the option of using the Price field with the properties set to Min for one column and Max for another?
    Regards,
    Nitin S.

  • How to get users' login logout time for user IDs for a specific date?

    Dear All,
    There is a case I being requested to retrieve the Userid, User Name,
    User Group, User Dept, Date, Login Time, Logout Time in a specific date, for example, 21.05.2009.
    How should I retrieve the information? The user want to input specific date and user group then return the details that mentioned above.
    I try with SUIM->Users->By Logon Date and Password Change... but I can't specific the date that I want ...
    I try with SM19 (Security Audit Log), but unfortunately in my system this is not activated.
    I've seek for SAP's advise, and they say need to ask abaper to developr a report in order to get such details....
    Do you guys have any other methods?
    Do you guys know which tables will contain the details as mentioned above?
    Best Regards,
    Ken

    Unfortunately without the audit log, you're going have a hard time finding this information.  As mentioned, ST03N will give you some information.  If your systems daily workload aggregation goes back to the date you require then you'll be able to get a list of all users who logged on that day.  ST03N doesn't keep time stamps just response times.
    My only idea is VERY labor intensive.  If your DB admin can retrieve a save of the database from that day then table USR02 will hold a little more information for you.  It will contain last login times for that day.  If your system backup policy happened to have saved the contents of folder "/usr/sap/<SID>/<instance>/data" then you potentially have access to all the data you require.  The stat file will have recorded every transaction that took place during that day.  If that file is restored you could use program RSSTAT20 to query against it.
    Good luck and turn on the audit log as it makes your life much easier!

  • How to get the date n time for log in ODI

    Hi,
    I wanna ask, what is the syntax for getting the date n time when i specify the location of log for Interface. Thanks.

    I quite do not get what you are trying to achieve here.
    - In a mapping, use the DBMS engine sysdate command.
    - In a variable, you can refresh the variable value using a "select sysdate from dual" type of query.
    - You can also use the appropriate odiref substitution method to get a date. For example:
    Current year is: :<%=odiRef.getSysDate("y")%>
    Hope this helps.
    -FX

  • How to get the max value in the query??

    Plant  calday(mm.dd.yyyy)       Soldout.Qty
    0001   01.01.2005               10
    0001   01.02.2005               20
    0001   01.03.2005               05
    0001   01.04.2005               16
    0001   01.05.2005               10
    0001   01.06.2005               14
        From the above values , how can i findout Max(Soldout.Qty)(i.e 20) for the above week...Suppose present aggregation = summation...How can i findout the value in the Query??don't want to do changes to design...

    Hi Bhanu,
      I tried the calculation results as...Maximum,..
      But that will pick the maximum value among the avialable values..like
    plant1 max 10
    plant2 max 20
    plant3 max 30
    then it will show as..
    plant1 max 30
    plant2 max 30
    ...like this...but my case is
    plant1 calday1 10
    plant1 calday2 05
    plan1  calday7 08
    plant2 calday1 10
    plant2 calday2 05
    plan2  calday7 20
    so for each set it need to bring the maximum value...

  • How to get the last update time for a table ?

    I want to know the last change of the table data , for example, a record has been changed, how can i get that time?
    Regards,
    Lament

    Hello
    check the tables CDHDR & CDPOS
    But the condition when u r checking the these table.for a particular field the at data element level- futhur charactestictab level we have one check box called change document it as tick
    Thank u,
    santhosh

  • How to get the values multiple times for the specified element - ABAP IXML.

    Hi all,
             i have requirement to get the values for the specified elements multiple times. eg:., if the element is used in the xml 4 times then i need to get all the 4 values.  here is the sample xml,
    <View mmRelease="6.30" mmVersion="2.0" mmTimestamp="1180099591892" name="Comp_viewtestView" package="sap.com" masterLanguage="en">
    <AbstractView.InboundPlugs>
    <InboundPlug name="ip2">
    <ParameterizedFeature.Parameters>
    <Parameter name="ippara2">
    <Parameter.Type>
    <Core.ForeignReference modelName="DtDictionary" package="com.sap.dictionary" name="binary" type="DtSimpleType"/>
    </Parameter.Type>
    </Parameter>
    </ParameterizedFeature.Parameters>
    </InboundPlug>
    <InboundPlug name="hi">
    <ParameterizedFeature.Parameters>
    <Parameter name="hipara">
    <Parameter.Type>
    <Core.ForeignReference modelName="DtDictionary" package="com.sap.ide.webdynpro.uielementdefinitions" name="Visibility" type="DtSimpleType"/>
    </Parameter.Type>
    </Parameter>
    </ParameterizedFeature.Parameters>
    </InboundPlug>
    Here i need to store the following values in internal table, the element to get the values are,
    (1) InboungPlug name and the respective values of "Parameter name" and "Parameter type" name value.
    The output will be of 2 records & values should be
    Inbound plug name = ip2
    Parameter name    = ippara2
    Parameter type      = binary
    2nd record
    Inbound plug name = hi
    Parameter name    = hipara
    Parameter type      = Visibility
    These 2 records should be in internal table and then i will be passing to database table...
    Can anyone provide me the code for the above......
    Thanks in advance,
    Vishnu.

    I didn't get ur requirement..
    As per my understanding, upload the XML file into an internal table and then loop over the internal table and get the values for ptype and pname..
    XML ABAP  -  may b helpfull
    Edited by: Veeranji Reddy on May 7, 2009 2:10 PM

  • How to get rid of the "time" for the airport connection?

    Hello,
    When I connect to the wireless network at my house my Airport Symbol (top right of screen by date & time, speaker volume, etc) shows the amount of time spent on the wireless network. It shows it in day, hour, minute & second. When I connect to wireless networks outside of my home, the airport symbol is there, but with no "time" next to it.
    How do I set this up so that no "time" is showing but the airport symbol remains?
    My buddy's "time" never shows up, but when he comes to my house it does...
    I cannot seem to find the setting to remove just the time...
    Please advise.
    Thanks in advance.

    Found it... It can be changed via the drop down menu from the wireless icon in the top right part of the screen. You can get an second menu from your network name and can choose to show the time or not.

  • How to get the last modified time for directory?

    Hi,
    I have to accomplish this.
    A folder c:\myfolder can literally contain anything files.. sub directories, fiels in sub directories.
    I have a thread monitoring c:\myfolder, basically people can dump files in any order into that directory and I have to trigger something when there is no activity on c:\myfolder for 10 secs.
    I tried lastModified() with File("c:\myfolder") but that seems to be working only if there is some change on root level of c:\myfolder, for eg if I have a sub folder c:\myfolder\subfolder and I copy some file into c:\myfolder\subfolder, then the lastModified() doesnt seem to be updatiing on the mail folder "c:\myfolder"
    Is there a way I can handle this situation?
    Any suggession is appreciated.
    Thanks in advance.

    I was looking to accomplish this using simple java
    code without any 3rd party involvment.Then you will have to monitor all the directories that people might dump files into. You can't expect Java to automatically deal with things that the operating system doesn't support just because those things happen to be your requirements.

  • How to get the last modifed time for table & its constraints

    Hi All,
    I have table. I want to know when it is modified last. Actually few constraints are added to the table. I want to find out when the constraints are added to the Table.
    I am using Oracle 9. Could you help me out plz.
    Regardds
    Ashish Mishra

    Check LAST_DDL_TIME from USER_OBJECTS, and LAST_CHANGE from USER_CONSTRAINTS.

  • Time phase Min/max replenishment models for future dates

    Hi,
    We are working on a safety stock requirement of Maximum/Minimum replenishment model in APO.
    It seems to work great except it cannot be time phased.  Our business wants different safety stock strategies at different times of the year. 
    Please suggest if there is a way that we could “time phase” min/max replenishment models for future dates?
    Thanks in advance for your help!
    regards
    Yogendra

    Many thanks for this.
    I can see entirely why it's designed as such, but I just find it slightly frustrating that there's no way to break the link between the order and the shipment out to the depot. Just to clarify, we're not requiring the orders to change - they will still be made and will come in - but just that the orders themselves don't specifically need to be the stock that is used for the replenishment.
    So -
    1. Min Max identifies depot needs replenishing.
    2. Central distribution does not have (enough) stock to replenish.
    3. Order is made to replenish central distributions stock.
    4. We ship whatever we've got, when we've got it, to depot to replenish.
    It's the bit where Min-Max is trying to replensih a specific depot rather than our central distribution centre that's my problem.
    I suspect that, as you say, that specific issue is not directly fixable without getting our IT contractors to do a customisation.
    I'm going to look into your Supply Date Offset suggestion now, though I'm not sure how this affects the shipping after the orders are placed. The orders themselves are approved manually after we've checked our stock position (i.e. what's in with the recycling team), but we recycle & refurb probably 60% of our maint stock so there'll always be kit turning up after the order has been made because of the long lead times.
    Thanks again.

  • How to schedule a job occurring time for 1 1/2 hour in sql server

    how to schedule a job occurring time for 1 1/2 hour in sql server

    Hi,
    This is a known issue in the previous SQL Server version and has been fixed in SQL Server 2012. You should be able to set 90 minutes and the change would be saved in SQL Server 2012.
    http://connect.microsoft.com/SQLServer/feedback/details/346786/ssms-does-not-support-job-schedule-frequencies-greater-than-60-minutes
    Currently, you may schedule the job to occur every 1 hour or you may refer to the suggestion by Latheesh to get around this.
    Thank you for your understanding.
    Tracy Cai
    TechNet Community Support

  • How Do I Detemine Maximum DVD Time For A PCM Audio DVD

    I have been working with my CS2 Premiere to create some auto play, audio-only DVDs that are autoplay.  To clear the air, yes I know that CS4 will permit 24bit-96 kHz.  For the time being 16 bit-48 kHz will suffice as it has CD quality  The bonus that a DVD format provides a greater playing times.  So the object is to make a PCM audio only DVD.
    Here is my problem: How to get really long playing time.  I know I can make high quality, 2-channel (ordinary stereo)  DVD-A's up to 3 hours using Minatonka Bronze.  Unfortunately, DVD-A discs are worthless as they cannot play in 90% of DVD players, but they prove the time point.  I would think that one should be able to make a conventional DVD, but with the PCM sound format of that same length.
    I just finished one that fit with a 103 minute, 16/48 stereo audio file of 1.11 GB size.   I also had a video file that I created using several photos. Sorry, don't have the final video file size.  I erased it all from my computer.  However, the final disc size was 3.754 GB.  A little extrapolation suggests a maximum DVD length of 119 minutes.  That with simple video and PCM audio.  Now, can one make a similar DVD with 150 minutes?
    I had three 48 kHz files that I created in Adobe Audion.  They were 1.599, 0.911, and 0.974 GBs in size.  That added up to 3.480.  The playing time is about 2:30 Hours; quite a bit less than 3 hours.   I tried burning a DVD with these, audio-files-only.  I checked lowest quality video, used no video, and got an Export To DVD error that I had "insufficient" space on the 4.7 GB disc!  So, I used the two latter files, which added to only 1.884 GB.  Premiere did not baulk, and it successfully burned a DVD that played.  Then I added the 1.599 GB file, and, once again, it produced an error.  This was clearly not going to work.
    At this point, I realized that Audition had done what it liked to do: It had saved the 16 bit-48 kHz files as 32 bit-48 kHz!  So, I went back to Audition and used EDIT to change the files to genuine 16 bit-48 kHz files.  When I opened them in Premiere, Premiere reported 16 bit-48 kHz files.  Their sizes were now, 0.799, 0.456, and 0.487 GB.  Please note that this totals 1.742 GB.  This is less than the 1.884 GB I had successfully used before.   Once again, I was getting the "insufficient" space error.
    I searched the CS2 Premiere manual and its index, but cannot really find any way to calculate maximum times, or squeezing the most out.  So, anybody got some ideas?
    Mike

    When working from DVD-Videos, this ARTICLE might be helpful - All VOB's (the container for the MPEG-2 files in a DVD-Video) are not created equally.
    Most DVR's write a VOB 01, that is not up to the DVD-specs. That can create a problem for PrE (and also PrPro), and if you have issues, please do follow Neale's advice.
    Good luck and welcome to the forum.
    Hunt

  • How to get rid of the "time out" when using DAQ AI in the example program

    I try an example file called "AcqVoltageSamples_IntClkDigRef" (Visual C++ .NET). It works great. However, if the program has not recieved the data, it sent out a timeout message. How to get rid of the "time out"? I cannot find anywhere in the code. Is this a property I have to reset somewhere else?
    Thank you,
    Yajai.

    Hello Yajai,
    The example program will use the default value for timeout, 10 seconds. To change this, you will have to set the Stream.Timeout value. I inserted this function into the example and set it equal to -1, and the program will wait indefinitely for the trigger signal without timing out. Please see the attached image to how this was implemented.
    I hope this help. Let me know if you have any further questions.
    Regards,
    Sean C.
    Attachments:
    SetTimeout.bmp ‏2305 KB

  • How to Set A Default Start Time For New Events In Calendar?

    How to Set A Default Start Time For New Events In Calendar?

    John,
    Thanks for that suggestion - could not get it to work. However, I did manage a different approach. I finally determined the sequence of events in terms of how the various events and listeners fire (I think).
    Basically, the CalendarActivityListener fires, followed by the listener associated with the Calendar object's Create facet, followed finally by the CalendarEventListener - the final is where the TriggerEvent is available and then finally, control is passed to the popup/dialog in the Create facet. So, my approach of trying to set/get the TriggerDate in the user's HTTP session was doomed to failure because it was being get before it had been set :(
    Anyway, I ended up adding a bit of code to the CalendarEvent listener - it grabs the current BindingContext, navigates through the DCBindingContainer to derive an Iterator for the ViewObject which drives the calendar and then grabs the currently active row. I then do a few tests to make sure we're working with a "new" row because I don't want to alter start & end dates associated with an existing calendar entry and then I define the Start and End dates to be the Trigger Date.
    Works just fine. Snippet from the listener follows
    BindingContext bindingContext = BindingContext.getCurrent();+
    *if ( bindingContext != null )    {*+
    DCBindingContainer dcBindings = (DCBindingContainer) bindingContext.getCurrentBindingsEntry();+
    DCIteratorBinding iterator = dcBindings.findIteratorBinding("EventsView1Iterator");+
    Row currentRow = iterator.getCurrentRow();+
    if ( currentRow.getAttribute("StartDate") == null)+
    currentRow.setAttribute("StartDate", calendarEvent.getTriggerDate());+
    if (currentRow.getAttribute("EndDate")==null)+
    currentRow.setAttribute("EndDate", calendarEvent.getTriggerDate());+
    *}*

Maybe you are looking for

  • Unable to see Arch in rEFInd on MacBook Pro 11,3

    Hello fellow Arch users! I installed Arch on my MBP as per the wiki, using the latest arch boot-network.iso on a USB stick.  The stick booted just fine from rEFInd after using dd to copy the image to the stick.  After the installation (sans bootloade

  • Down Payment Processing on the Basis: Document Condition

    Hi all, since Enhancement Pack 2 there is a new possibility of down payment process. The new process is not depending on billing plan instead depending on Document conditions. With this you can also have the the final invoice delivery related. In the

  • Solaris 10 x86 b72 "Cannot find boot.bin" booting from SCSI.

    Hello, After several gyrations of installation attempts and dealing with early BIOS PnP issues, I've finally managed to get Solaris 10 x86 installed on an old dual P2 333Mhz system. So far the system is running flawlessly, but I'm still not able to b

  • How to save content of JPanel into jpeg or png file

    I have to independent classes: Class A and Class B. Each class constructs its own graphical objects: Class A { //do something public void paintComponent(Graphics g) int x = 0; int y = 0; int w = getSize().width; int h = getSize().height; bi = new Buf

  • Dreamweaver CC refuses to run

    I have a current subscription to Adobe CC and have just downloaded Dreamweaver CC.  However, when I try to run it, it immediately quits.  I'm on a Mac running under Mavericks.  I've tried the following with no luck: Restarting my Mac Uninstalling Dre