How is posible to execute in very different periods the same stored proc ?

Hello,
I call a store procedure many times on the same session. First 10 executions take place in 30 sec; next calls take 5 sec each.
This behavior is constant. I think it has to do with the statistics computed by Oracle, but how can I improve first
executions, too ?
Thank you,
Lucian Davitoiu

It might be.
Anyway, it is strange that long times are obtained for 10 consecutive executions. Starting with 11st execution, it's period is 6 times shorter. Does it need 10 execs to keep it in memory ?
On the other hand, this is happening on session level. I mean, I have 2 session; on first session stored procedure executes in 30 secs and, in the same time, on the second session the same stored procedure executes in 5 secs (only because the second session already executed stored procedure 10 times). I think, if procedure would be in memory it will be a global area, and both sessions will execute the proc in the same amount of time, isn't it ?
Most important is how I might control this behavior ?
Thank for your ideas,
Lucian Davitoiu

Similar Messages

  • Multiple threads calling the same stored proc with different parameters

    Hi,
    I have a stored procedure which will be called by 8 threads. Every time it takes in a different parameter.
    Actual execution time for this proc (irrespective of the parameter) is around 2 seconds. But when I call the 8 threads, I see that the total time taken (END TO END) is around 16 seconds. Threads do acquire a read lock right? Is there a way i can get over this issue?
    Please let me know.

    Sybase IQ is the database. I am using a thread pool. The time taken to execute this procedure without threads is about 2 seconds. It takes 16 seconds when I start using threads.
    I do something like this :
    ///////////////////////// databaseThreadPool.java
    * example of a fixed-size thread pool using the
    * executors introduced in Java 5
    import java.util.concurrent.ExecutorService;
    import java.util.concurrent.Executors;
    public class databaseThreadPool
    public static void main(String[] args)
    * create a thread pool with four threads
    ExecutorService execSvc = Executors.newFixedThreadPool( 8);
    * place six tasks in the work queue for the thread pool
    for( int i = 0; i < 6; i++ )
    execSvc.execute( new CountDown() );
         long a =System.currentTimeMillis();
    execSvc.execute( new databaseThread("00055","YTD","GROSS") );
    execSvc.execute( new databaseThread("00055","YTD","NET") );
    execSvc.execute( new databaseThread("00055","YTM","GROSS") );
    execSvc.execute( new databaseThread("00055","YTM","NET") );
    execSvc.execute( new databaseThread("00055","LY","GROSS") );
    execSvc.execute( new databaseThread("00055","LY","NET") );
    execSvc.execute( new databaseThread("00055","LLY","GROSS") );
    execSvc.execute( new databaseThread("00055","LLY","NET") );
         long b =System.currentTimeMillis();
         try{
         while(databaseThread.done!=8)
              Thread.sleep(1000);
         catch(Exception ex){}
    execSvc.shutdown();
    System.out.println("END TO END TIME TAKEN : "+(b-a));
    /////////////////////////////////////////////////////////// databaseThread.java
    import java.io.PrintWriter;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.Statement;
    import java.io.PrintWriter;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.io.IOException;
    public class databaseThread implements Runnable
    protected int count = 8;
    * the following counter is incremented once
    * each time the class is instantiated, giving each
    * instance a unique number, which is printed in run()
    private static int taskCount = 0;
    private final int id = taskCount++;
    private String gpNum;
    private String time;
    private String domain;
    public static int i=0;
    public static int done=0;
    PrintWriter out = null;
    Connection connection = null;
    Statement statement;
    ResultSet rs;
    ResultSetMetaData rsmd;
         CallableStatement cStmt = null;
    public databaseThread(String gpNum, String time, String domain) {
    this.gpNum=gpNum;
    this.time=time;
    this.domain=domain;
    * print the id and the iteration count to the console, then
    * yield to another thread.
    public void run()
         try
         Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
         connection = DriverManager.getConnection("jdbc:sybase:Tds:XXXXXXXXXXX:XXXXXXX", "cp_dbo","cp_dbo");
         statement = connection.createStatement();
              cStmt=connection.prepareCall("{call XXXXXX ?,?,?)}");
              cStmt.setString(1,gpNum);
              cStmt.setString(2, time);
              cStmt.setString(3,domain);
              long a =System.currentTimeMillis();
              rs=cStmt.executeQuery();
              long b=System.currentTimeMillis();
              System.out.println(id+" Time taken by to execute Query : "+(b-a));
         //rsmd=rs.getMetaData();
              while(rs.next())
              Thread.yield();
         catch (ClassNotFoundException e) {
              System.out.println("Driver Error" );
              e.printStackTrace();
              } catch (SQLException e) {
              System.out.println("SQLException: " + e.getMessage());
    }

  • How to multiple/ parellal sets of books to generate more than one financial statement based on different (or the same) accounting principles.

    How to multiple/ parallel sets of books to generate more than one financial statement based on different (or the same) accounting principles.
    My Client needs Parallel Ledger in SAP B1 similar like SAP ECC. Is this functionality available ?

    Dear Mr. Nagrajan,
    Thank you for your response. I have already gone through documents but not able to understand. Is there any setup for this ? or its just work around i.e. using template and special field in JV i.e. Ref. 1 /2
    My doubts :
    I understand that Chart of Account structure is one and common for IFRS and other accounting method. We need to create only those account separately ( 2 times with prefix like IFRS revenue account, GAAP Revenue account).
    Now at time of entry, Assume some entries / adjustment are specifically for IFRS and not for other ledger. In this case, What need to do ?
    You have mentioned about DTW approach but do we need to insert all JV's again with other ledger ?
    Someone suggested that if any entry which are specific to IFRS Ledger, We need to user Ref.1 /2 column or Transcation code column and in which we can put IFRS
    Based on this, Need to create 2 seperate template for IFRS and other ledger for all report.
    This is my understanding of Solution in SAP B1. Please help me to clarify my though process
    Please do needful.If you have done implemenation and if you can share doucment, it would be great help.
    Email :[email protected]

  • In iphoto, how do i save a photo after editing, in the same or higher file size, it's saves in a lower size

    in iphoto, how do i save a photo after editing, in the same or higher file size, it's saves in a lower size

    It's rather more complicated that this.
    iPhoto is a lossless editor. You don't lose any quality on your shot in iPhoto.
    The file size you see reported is the size of your iPhoto Preview: this is what gets used if you access the data via a media browser. It's a "good-enough-for-most-uses" version of the shot. Email it, upload to websites, use it in Presentation, Word processing file etc
    If you want to set the quality yourself then Export the photo using the File -> Export command.
    You can choose to export to Jpeg, Tiff or png. Tiff is lossless but the file sizes are up to 10 times larger. Jpeg allows you to choose different qualities: High, Medium or low. The difference is the amount of compression involved. High quality means very little compression. It's not unusual for photos exported at this setting to have a larger file size than the original.
    Which setting you choose depends on the use you intend. Further editing, printing then high is important. Sending to Facebook? Well low will do just fine there as they're going to trash the file anyway.
    But the key point: the file size only becomes an issue when you export.
    Regards
    TD

  • I have changed my Apple ID on my iPad, but my iPhone keeps popping up with the old ID.....how do I get all my devices to use the same ID?

    How can I get all my devices to use the same Apple ID?

    Different services on your iOS device (iMessage, Facetime, iCloud, iTunes and App Store) can be signed into with an Apple ID of your choice. Make sure you verify the settings for each device and that you are signed in to each service with the correct Apple ID.
    I'll do an example for iMessage:
    1) Go to settings on your iOS device
    2) Select "Messages"
    3) Select "Send & Receive"
    4) At the very top you will see "Apple ID", by selecting your Apple ID, you will now have the option to sign out of messages with the current Apple ID, and sign in with the new one.
    The steps for changing your Apple ID for other services will be very similar.
    tHIS SHOULD BE VERY HELPFUL TOO YOU.

  • How to make use of adjacent data elements within the same buffer

    Hi,
             Does anyone know how to make use of adjacent data elements within the same buffer? To make my question clearly, I would like to give you an example. In my application, I set "sample to read" as 10 which means at each loop 10 data samples will be taken into a buffer. Now, what I would like to do is to do some calculations on adjacent data samples in same buffer. I tried to use "shift register" for this, but it seemed to me that it only can deal with the calculation between data from adjacent loops. In other words, it skips 9 data elements and take the 10th one for the calculation.
             Here I also attach my VI showing what I did.
        Thank you very much in advance,
                            Suksun
    Attachments:
    wheel_encoder_1.vi ‏98 KB

    Hi Suksun,
          I hope you'll forgive me for distilling your code - mainly to understand it better.  I tried to duplicate your logic exactly - which required reversing the "derivatives"-array before concatination with the current samples array.  As in your code, the last velocity is being paired with the first position.  If first velocity is really supposed to be paired with first position, just remove the "Reverse 1D Array" node.
    cheers
    Message Edited by Dynamik on 01-07-2006 03:17 AM
    Message Edited by Dynamik on 01-07-2006 03:19 AM
    When they give imbeciles handicap-parking, I won't have so far to walk!
    Attachments:
    encoder2.GIF ‏14 KB
    encoder2.vi ‏102 KB

  • How do I share music between two accounts on the same i-mac

    How do I share music between two accounts on the same i-mac

    iTunes: How to share music between different accounts on a single computer - http://support.apple.com/kb/HT1203 - relocating iTunes' media folder to a shared area but leaving separate library files - extra tip at https://discussions.apple.com/message/17331189

  • Same colors appearing different in the same document

    I have a document where I have filled different table cells with the same RGB color. However, they sometimes appear as two different shades, one darker than the other. I checked to be sure it was the same RGB color and it was, but it appears quite different both in InDesign and when I export it to pdf. Any idea why the same color is appearing differently in the same document?

    It doesn't appear to be a monitor problem, as the colors are different both on my laptop screen and on my external monitor. As I do not have the ability to print a hard copy before the file gets sent to the printer to make a proof, I need to know which is the "right" color (or at least the once closest to how it will print). Even if the colors are showing up differently on screen, if the swatch for both is exactly the same, will it show up as the same color once the actual hard copy is printed?

  • TS3274 I play candy crush both on my IPad and my samsung android, how do I synch them so they both show the same results?

    I play candy crush both on my IPad and my samsung android, how do I synch them so they both show the same results?

    We went through the same drill.
    First, decide which computer you are going to use.  One or the other.  You can't have it both ways.
    Then plug in the 'foreign' device.   Do not let it sync.  Yet. 
    Give this device a new name in the left pane in I tunes so that you all know which device is which.  You will need to authorise the computer to the new I tunes account.  You will need to transfer any purchases to that computer.  You will need to upload any photos to the photo library.
    Then sync.   Each time you plug it, it will remember the specific device, the old on, or the foreign one, and bring up its own particular arrangement as a starting point.
    You will find that by checking the boxes, you can share apps, and music.   But when you go to do updates, if you are mingling apps, each user will need to know the apple password to get updates.
    We found it to be a little confusing, but once you get used to it, using the same I tunes for 2 different accounts works ok.
    Before you do anything, please make a full backup ofmthe original device.  If something gets out of hand, you can always revert back to where your were.

  • I have two iPads. With two functioning iPads. Is it possible (on the same ID) to sync two of them differently with the same account. So I want to use the new iPad for all my current functions. The old iPad for just my music collection?

    I have two iPads. With two functioning iPads. Is it possible (on the same ID) to sync two of them differently with the same account. So I want to use the new iPad for all my current functions. The old iPad for just my music collection and remove all the other stuff?

    Very easily. I have an iPod touch and iPad on the same account with totally different content.
    If you use iTunes, connect each iPad to your computer and open iTunes and deselect any automatic updating/syncing. If you don't sync with iTunes but have them set up independently, under the settings, App Store, turn off automatic downloads for apps, etc.
    I'm old fashioned, I set up and sync my iPad and iPod to my computer and iTunes. Each device has a different name  and I manage content manually and only allow sharing on what I want shared.

  • How can I get "IMAQ Line Fit" stable (with the same points)

    How can I get "IMAQ Line Fit" stable (with the same points)
    I my vision applications I use a lot off times "IMAQ Line Fit"
    some times the results are not Stable.
    See vi and word document attached.
    When I take the same points but in a other order (sort)
    then suddenly all points are used.
    In this case I was looking for a edge in vertical direction (Y).
    I found the points but "IMAQ Line Fit" did not function well.
    I tried changing all settings like pixel radius and minimum score and
    also threshold and so on. But no result.
    Then I sorted the points reversed and that worked. See vi.
    I use labview Labview 8.6.0 and IMAQ machine vision.
    Maybe this problem is solved in a newer version.
    Please let me know.
    Thanks
    Attachments:
    TEST-imaq-line-fit-86.vi ‏169 KB
    IMAQ-Fit-Line-Problem-86.doc ‏230 KB

    Thank You for your reaction Hossein,
    This "one application" uses "Line fit" about 20 000 000 times a day.
    about 200 will go wrong. With your setting the the "Line fit" for this occasion will work but others will go wrong.
    A algorithm should be:
    1e Stable, when using the same points and settings the result MUST be the same. How the points are sorted should not matter.
    2e Accuracy
    3e Speed
    4e Testing. Is very difficult but al least close points and the same points and sorting ... should be done
    NI now as made a " IMAQ Line Fit" Problem CAR (Corrective Action request) 298016.
    so in the future there will be a update.
    In the mean while a made a line fit which uses Bisquare option from Linear Fit.vi :
      from C:\Program Files\National Instruments\LabVIEW 8.6\vi.lib\analysis\6fits.llb
    This is a temporary fix because "IMAQ Fit Line VI" is not so stable.
    Because outliers should be rejected only Bisquare does this reasonable.
    This program does NOT USE "Minimum Score" and "Pixel Radius"
    Valid fit = When there are enough points within Outlier_Distance.
    Algorithm steps:
    - Determine if line is more horizontal then vertical, Compare DeltaX with DeltaY
    - If DeltaX <= DeltaY then SWAP X Y and later Swap back
    - Sort Points at on X value
    - First : Bisquare Linear Fit
    - Calculate distances to the found line for all points
    - Inliers: Points within Outlier_distance
    - Outliers: Points outside Outlier_Distance
    - Only use Inlier Points
    - Check again if DeltaX < DeltaY then SWAP X Y later SWAP back again
    - Second : Bisquare Linear Fit only with the Inlier Points
    - Results are from the second fit
    Warning : This Program is Not so accurate and Not so fast
    See attachments it is in labview 8.6
    If some has a improvement please let me know.
    Thanks
    Attachments:
    svi_fit_line_Bsquare_and_draw.vi ‏18 KB
    Fit_Line_Bisquare_Linear.vi ‏40 KB

  • How to associate an already used iPhone 5S with the same iTunes?

    Recently I had a breach into my account (been hacked). Money was taken off from my account.
    Due to this I have restored my iPhone. I created a new ID and password.
    However now whenever I try to install the already purchased apps onto my iPhone I get the error message the my computer is not authorized.
    No matter how many times I authorize my computer I get the same message. then that the computer is already authorized.
    I did a little search and found out that my iPhone now is the one that is not associated with my iTunes account.
    Is there a way to associate my phone with my iTunes Store account again or I'll have to take even more loss now and rebuy all the apps for which I already paid once?

    Hi attrium,
    You may need to authorize the computer with the correct Apple ID.
    The items you're trying to play might have been purchased using a different iTunes Store account. To determine which account was used to purchase an item, follow these steps:
    Select a purchased song in your library and choose File > Get Info.
    Click the Summary tab. Note the Account Name that appears in the list. This is the account name (Apple ID) you'll need to use when authorizing your computer to play this purchase.
    Note: The account name that appears is the one you used when purchasing the item and does not change if the account name (Apple ID) changes.
    If you've authorized the Apple ID that is shown in the Summary tab, you can check the purchase history for that Apple ID from Store > View My Account. If your purchase history does not reflect the purchase of the items in your iTunes library, consider any other Apple ID you may have created, and authorize the computer for your additional Apple ID.
    If you forgot the password to one of your accounts, you can recover it using Apple's password-recovery website.
    iTunes repeatedly prompts to authorize computer to play iTunes Store purchases
    https://support.apple.com/en-us/HT203160
    Regards,
    Allen

  • How many times can you clean install leopard on the same computer?

    How many times can you clean install leopard on the same computer? Will the leopard dvd run out of installations and not let you install anymore?

    Hi colman Prez;
    Now that the funny comments have been made, I have a serious question and that why are you worry about reinstalling Leopard with an Erase & Install which is what I take that you mean when you say clean install. In actually fact there is no such thing in OS X as a clean install.
    I am curious because in all the years I have used OS X, I have yet to do an Erase & Install yet.
    I know with Windows that they suggest reformatting and reinstalling at the drop of a hat but that isn't true with OS X.
    Allan

  • HT1351 I have a new iPod Touch......I was able to successfully set up a new account, but I want it to be separate from the 800 songs I already have in my iTunes library.  How do I set up a separate library on the same computer?

    I have a new iPod touch; I have an iTunes library of music for an older iPod shuffle.  I'd like to set up the iPod touch for my wife with a separate library of music - I was successful in setting up a separte account, but it seems my 800 songs are still there in the library.  How do a set up a new account on the same computer without bringing along all the music that will clog up her iPod touch?

    There's a few ways of doing it. The following document may be of some help:
    How to use multiple iPods, iPads, or iPhones with one computer

  • How do I get IE 11 to open in the same window on the task bar?

    How do I get IE 11 to open in the same spot on my task bar.  i.e. IE 11 is on my task bar. When I open it, it opens in a new place on the end of the task bar.  Microsoft Outlook, Windows Explorer, Quicken, Adobe, etc,, all on the task bar open
    right at there location on the task bar; not in a new place at the end of the task bar.
    How do I get IE 11, Windows 7, 64 bit to open at the same place as the IE icon???
    Thanks

    Hi,
    Seems a strange issue, How about un-pin IE from the taskbar, then re-pin it to the taskbar for a test?
    If doesn't work, I suggest you turn off IE 11 in "Turn Windows Features on or off", reboot PC, then re-turn on, check the result again.
    Regards
    Yolanda Zhu
    TechNet Community Support

Maybe you are looking for