Huge performance difference between stored proc and anonymous PL/SQL block.  Why?

Hello!  I searched various online resources and have been unable to find those who have addressed this problem, so I hope that someone here may be able to offer advice.

I have a stored procedure that is approximately 300 lines long, takes no parameters, and sets a record and a few types of internal tables.  When I run it on a particular data set, it takes about 50 seconds at the end of my environment.  Unfortunately, it will have to be performed as a block anonymous PL/SQL instead of a stored procedure, because of the policies that exist about the environment which I deployment.  However, when I converted it to an anonymous PL/SQL block, make no other code changes whatsoever and it connecting the same schema that belongs to the stored procedure, it takes about 6.5 minutes (nearly 8 times as long) to complete.  Aside from the burden of analysis and validation, which could add a fraction of a second, can someone please suggest some possible reasons for the large performance difference and offer advice on what I can do about it?  In which case it is important, the procedure uses in bulk binds (for example, in bulk collect, forall) where it makes sense and doesn't call other objects in PL/SQL.  Thanks in advance.

Without seeing your code, it is difficult for me to contribute more.

Note also that...

1 roles are turned on in the anonymous blocks but not (at least not by default) in the stored procedures. This is why the anonymous block could have MORE rights (those granted through roles) probability that you can get more items through anonymous block.

2. ensure that, in both cases, it does reference the same target tables.

Debug by calculating the difference of time after certain steps in your code. Who should get an idea on this or activate the trace.

Tags: Database

Similar Questions

  • Difference between stored procedure and procedure

    Hello

    could you please let me know what is the difference between the procedure and the stored procedure PL/SQL.

    Thank you.

    Best regards
    Mohan

    Published by: user10469960 on November 21, 2008 18:33

    There is no difference. The two terms are synonymous. Intrinsically, a PL/SQL procedure is stored in the Oracle data dictionary.

    Justin

  • "Declaration of execution" and anonymous PL/SQL blocks

    I often use control - enter to execute the statement that the cursor is currently over.  Normally, this works very well.  But it's a little twisted once I added an anonymous PL/SQL block to the worksheet.  As long as the anonymous block is the last thing on the spreadsheet, I can "run statement" as usual.  But if I add a SQL queries after an anonymous block and try to run the statement, rather than just the running query, SQL Developer aims apparently to compile everything since the beginning of the first anonymous block until the current as a block statement.

    For example, if I have a spreadsheet as follows:

    SELECT 1 FROM DUAL;  --run statement on this line works as expected, running just this query
    
    BEGIN  --run statement anywhere within this block works as expected, running just this block
      DBMS_OUTPUT.PUT_LINE('X');
    END;
    
    SELECT 1 FROM DUAL; --run statement on this line goes back to the "BEGIN" on line 3 and gives a compilation error
    

    It is a nuisance major for me, as I have often a mixture of SQL and anonymous blocks on a worksheet.  I know that I can point out that the code I want and execute statement in this way, but I'd rather not have to do.  I was expecting that developer SQL would be smart enough to know where each block begins / ends and realize my current statement is not part of the block above him. Is there a setting that can change this behavior?  Or is it the way it is supposed to work?

    Whatever it is, thanks for the excellent tool.

    Add a ' / ' at line 5 and line 5 to line 6 bump

  • Openfiler as NAS for ESXi shows the performance difference between software RAID6 and RAID10.

    I had some performance issues with a new ESXi server with virtual machines hosted on a table of 6 software RAID (12 units of optical fiber). Here's what it looked like:

    12 multi-plate (RAID 6) -fiber channel- Openfiler.


    NFS - VMWare ESXi

    Since I had a spare CF array I decided to fix to the Openfiler box and try to RAID 10 in software. Different performances has been staggering. I did a lot of steps, but I test the startup time of a computer virtual stored on each table of FreeBSD.

    RAID 6 59 seconds

    RAID 10 45 seconds

    Now waiting for MBR of FreeBSD for 5 seconds and the boot loader expects 10, so there were at least 15 seconds of downtime in each case. The strange thing is that accessing directly the matrix RAID 6 via FTP provided good performance. I was able to saturate a 100Mbit link and the Openfiler Server showed almost no load. But with the VM on the RAID 6 array, the load on the Openfiler area would jump to 4 +. I hope it helps someone.

    Jason M.

    It's better.  What system and mount underlying file options are used?

    http://blog.peacon.co.UK

    Please give points for any helpful answer.

    Unofficial list of transfer USB devices work

  • SQL Native Performance difference between coded hard and parameter value

    Hello

    I have a SQL query (Oracle) native (quite long and complex with many subqueries) which returns in less than a second in ODSI and using an external SQL tool. This query contains a hardcoded for a particular, namely column value, a date column.
    When I change the function ODSI signature so that I have pass a parameter, and then replace the hardcoded value in the native SQL with the appropriate parameter binding notation (i.e. '?'), the query takes much longer (2-30 seconds). The duration of the query depends on how many records is returned, so he must execute a separate query for each of the outcomes (i.e. most returned results, longer the query takes to return).
    What can I do to maintain the duration of my low ODSI request while allowing the setting?

    Thank you. Try the oracle.jdbc.OracleDriver in WLS/ODSI, let know us.

  • Error when you try to create a region of the page generated by the anonymous pl/sql block

    Hi guys I tried to create a region of the page which is the source and anonymous pl/sql block and I have been making a few mistakes. Basically what I want this region to do, is to give the current user of the application one summarized data compared to there user name which is: app_user the code I used was

    declare

    ven_ret varchar2 (15);

    BEGIN

    ven_ret: = (select u.vendor of USERS4ARCHITEC u )


    where

    u.e_mail = V ('APP_USER')

    and not exists (select null from arch_tbl I where u.vendor = i.vendor and user_id = V ('APP_USER'))

    order u.vendor in ven_ret);

    END;

    /

    the structure of the table to the USERS4ARCHITEC table is

    User varchar2 (15) vendor2 (20)

    ----------------------------------------------------------------------------------

    user@1                                                                          sap

    user@1                                                                          oracle

    user@1                                                                           IBM                                                            <---------sample data

    user@2                                                                          Oracle

    user@2                                                                          cisco

    the structure of the table to the arch_tbl table is

    user                                                     vendor

    --------------------------------------------------------------

    user@1                                                 sap

    So if user@1 logs in the application of the region using the pl/sql code code above should display oracle and IBM, because these two sellers are always under his username that he has already used a form to insert the sap into the arch_tbl table. Please tell me what I'm doing wrong here. Thank you guys

    Why would you build a type psedu at APEX report MANUALLY when you can just build a relationship with the same selection you use now for your pl/sql dynamic region?  What is the purpose of building your own report when the tool made for you?

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • difference between the view and the procedure

    Hi Master,

    Today I received a request from my senior technical leader... !!

    Q > what is the difference between the view and the procedure?

    I got response like this...

    A view represents the logic of one or more tables/views. It won't take no place in db... It is a virtual table, query will only store in db... useful

    for safety... If the main table has obtained changes... automatically discovers also change... etc.

    Proecudure is a db object will be performs a perticular action... It may or may not return values. ?

    But somehow, he isn't happy... He expects more... .very close view of diff. b & w and procedure.

    Please explain it to me...!

    Concerning

    AR

    874273 wrote:

    Hi Blu,

    Thanks for your replies...! But we think if notice and procedure will be the same no matter what point of view? Both are the same? If Design view... We can create a stored procedure?

    How a view and procedure may do the same thing?  They are two different things with different objectives.  You use the correct one depending on what you want to achieve; they are not interchangeable.

    And another question...!

    (Q) how you will store Japan, characters of China in a database table? will there be a new feature in Oracle 11 g?

    (A) I use dbms_lob package? Japan/China characters are multi byte characters... so we can use the nclob data type?

    is this correct... ?

    No, it not there no novelty in Oracle 11 g for the storage of Japanese or Chinese characters, because there is already a feature for their storage in previous versions as well.  It is determined by the parameters characterset and nationality that you use when you create the database.

    Why would you choose to store them in a LOB using DBMS_LOB?  Yes, they have multibyte characters, but if you have configured your database for the correct character sets, for example using UTF - 8, then you can store the characters in VARCHAR2, like any other language.  The only difference is that the storage of 4000 bytes limit still applies, so you maybe isn't able to store 4000 multibyte characters in a varchar2 column 4000 single-byte, it can be as little as 1000 characters if they are all characters in 4 bytes.  (Note: 12 c limit in SQL can be increased up to 32,767 characters, to harmonize it with variable varchar2 PL)

  • Difference between the G20 and G25 models

    Hi people!

    I searched your laptop and I was amazed by the Qosmio.
    When I was going to order it, I noticed that there are many models of the G20 with different specifications. Also, I found G25 on internet research and found no difference between the G25 and G20 except receiver TV G25 is NTSC and G20 was released on March and G25 was in June. Instead, they have the same specifications for the hard drive.

    I live in the Portugal and the model Qosmio I can find that this is the G20-118. I was looking for the model that has 2 x 100 GB SATA HD, but cannot not thought about it.

    Internet research I found Qosmio G20-111 which has 2 x 100 GB SATA HD, but on the web page mentioned that it was a Pentium III processor (ridiculous, isn't?). I was looking for more reliable information.

    Already searched for toshiba pages and found no specifications for all models I found 490LS on the research on the web as the G20 - 102, 105, 106, 108, 109, 111, 118, 123,...

    Can someone help me with this? Are there any reliable web page where I can see the differences between the models? is there a .pdf or anyone who can please give me some advice?

    Money is not a problem at this time to acquire the laptop, I'm looking for only the laptop performance more!

    Best regards
    João Pereira

    Hello

    It of very difficult to say what camera is best, because there are many models with different parts.
    However, I found page with description of the G20 and G25.
    Take a look at this link.

    http://www.releasereview.com/Toshiba-Qosmio-G20-105-108-114.aspx?d=0101000580926052005

    Good bye

  • What is the difference between the KING and ACQWINDOW regarding the attributes of the camera?

    There are two sets of attributes for, left, top, width, and height.

    For example, there

    IMG_ATTR_ROI_WIDTH vs IMG_ATTR_ACQWINDOW_WIDTH

    MG_ATTR_ROI_HEIGHT vs IMG_ATTR_ACQWINDOW_HEIGHT

    What are the differences between the KING and ACQWINDOW?

    Thank you.

    Hi sunspotzsz!

    Vision consists of two main steps: acquisition and image processing.  IMG_ATTR_ACQWINDOW_WIDTH would the acquisition, and IMG_ATTR_ROI_WIDTH should be part of the treatment.  Therefore, if you set the ACQWINDOW_WIDTH to 100 so that numbers all pixels that are acquired will be set to 100, and they will be stored in a buffer.  ROI_WIDTH will use an image that is already in memory and 'zoom' so that the only part of the image you are watching / treatment.

    Also, take a look at this knowledge base on the Kings: KING FAQ you may find it useful!

    Kristen H.

  • What is the difference between. MHT and. HTM?

    Original title: is anyone know about MHT files?

    What is the difference between. MHT and. HTM?

    Hi Sheryl,

    Welcome to the Windows 7 community!

    I understand that you would like to know the difference between file MHT and HTM file. I'm happy to help you.

    MHTML, short for MIME HTML, is a format to archive web page used to combine resources that are usually represented by external links (such as images, Flash animations, audio files, Java applets) as well as the HTML code in a single file. The content of an MHTML file is encoded as if it were an email message to HTML, using the MIME type multipart/related. The first part of the file is normally encoded HTML; subsequent parts are additional resources identified by their URL original and encoded in base64. This format is sometimes referred to as MHT, after the suffix .mht given to these files by default when created by Microsoft Word, Internet Explorer or Opera. MHTML is a proposed standard, distributed in an edition revised in 1999 as RFC 2557.

    HTML Web page that is used by Web browsers; contains the code markup that is stored in a plain text format; used to display and format the text and images in a Web browser.

    HTM files serve the same exact than purpose. HTML files. The extension ".htm" appeared with the use of the Web Microsoft, such as FrontPage, SharePoint Designer and Expression Web development software.

    HTM files are much less common than HTML files.

    It will be useful. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you.

     

     

    Kind regards!

  • The difference between the ADR and ADF

    People,

    Hello.   I have implemented PeopleSoft Campus Solution 9.0 revision 5 for a University. I develop the application for Admission online for future student to apply for admission.

    I need to install Oracle ADF (Application Development Framework) or ADR (execution of Application Development) to run my application for Admission online web page for PeopleSoft Campus Solution 9.0, but I do not know the difference between the ADF and the ADR.

    My installations are below:

    Server machine: Oracle Linux 5.10 (64-bit)

    Client computer: Windows XP Professional (64 edition) with the Internet Explorer browser

    Architecture Internet Oracle Linux 5.10 Server:

    (1) database server: Oracle Database 11 g

    (2) the server application: Tuxedo 11 g

    (3) web Server: Web 11 g logic

    (4) browser: Firefox Mozila

    5) 8.53 PeopleTools and PeopleSoft Campus Solution 9.0 R5

    On the download page http://www.Oracle.com/technetwork/developer-tools/ADF/downloads/index.html , there are 2 packages to download:

    (1) execution of the 12.1.3.0 application development

    (2) oracle ADF essential 12.1.3.0

    My Architecture Internet of PeopleSoft as shown above has been working properly for a long time. Logical Web 11g works correctly. It seems that the first 'Application development performance' package also install logical Web server which is not necessary in my machine. In addition, ADR is not free, and we may need to purchase the license.

    Essential because ADF is free and without license fees, I chose Oracle ADF essential 12.1.3.0.0 to develop the application for admission online. I read his paper on http://www.oracle.com/technetwork/developer-tools/jdev/documentation/121300-cert-2164864.html

    9.0 Solution Campus system will be run by a University to do business formally.

    My questions are:

    First of all, what package is right for my application for Admission online Campus Solution 9.0? ADR or essential ADF?

    Second, if choose essential ADF, I have a few questions about the 12.1.3.0.0 ADF to match my installations as below:

    (1) as indicated in the document, ADF 12.1.3.0.0 can work with Oracle Linux 5 & 6 (64-bit) and other operating systems. ADF can also work with Windows XP? Can I install ADF with my Oracle Linux 5 server machine?

    (2) as indicated in the document, ADF 12.1.3.0.0 can work with Websphere Server Application. ADF can work with Tuxedo 11 g?

    (3) as indicated in the document, ADF 12.1.3.0.0 can work with the Firefox browser. ADF can work with Internet Explorer in Windows XP?

    Thanks in advance.

    If you want to use essentials, you must download the package from the essential. ADR is the complete stack where you must purchase a license.

    Timo

  • Difference between the trainer and plaintiff on a purchase requisition?

    Hello

    What is the difference between the trainer and the applicant on a purchase requisition?

    Where this information is stored in the database?

    Is there a standard on report box to find it.

    We want a report that gives information on which arouses requests on behalf of others.

    This report is an audit report.

    Thank you very much

    Emily

    What is the difference between the trainer and the applicant on a purchase requisition?

    Trainer - who prepares the document however applicant who is (concern the team or Department) request the material.  Normally preparer is the true owner of the document and control of the applicant manages the material to the organization once he sent by the provider.

    Where this information is stored in the database?

    PO_requisition_Lines_all holds the to_person_id the details of the applicant and created_by is trainer details.

    Is there a standard on the gear to find it

    Try the 'Purchase requisition Status Report' report, given the details of the applicant & trainer of the requisition.

    concerning

    Madhu

  • What is the difference between the model and its clone in VMware?

    What is the difference between the model and its clone in VMware?

    Clone

    A clone is a copy of the virtual machine.

    You can't convert back the cloned Virtual Machine.

    A Clone of a Virtual Machine can be created when the Virtual Machine is running

    Cloning can be done in two ways: Clone full and linked Clone.

    A full clone is an independent copy of a virtual machine that shares nothing with the parent virtual machine after the cloning operation. Continuous operation of a full clone is entirely separate from the parent virtual machine.

    A linked clone is a copy of a virtual machine that shares virtual disks with the virtual machine of parent on a regular basis. This preserves disk space and allows multiple virtual machines to use the same software installation.

    Cloning of a virtual machine can save time if you are deploying several similar virtual machines. You can create, configure, install the software on a single VM and then clone several times, rather than the creation and configuration of each virtual machine individually.

    Model

    A model is an original copy or a reference image of a virtual machine that can be used to create many clones.

    Models can be turned on or edited and are harder to change than usual of virtual machine.

    You can convert the model to the Virtual Machine update model base with the latest released patches and updates and to install or upgrade any software and still convert to template to use for the future deployment of Virtual Machines with the latest patches.

    Convert virtual machine model cannot be performed, when the virtual machine is running.  Only the Clone to the model can be performed when the Virtual Machine is running.

    A model offers a safer way to preserve a virtual machine configuration that you want to deploy several times.

    When you clone a virtual machine or deploy a virtual machine from a template, the cloned virtual machine resulting is independent of the virtual machine or the original model.

  • What is the difference between safety HFM and HSS

    Hi gurus

    1. What is the difference between safety HFM and HSS?

    Concerning
    Hubin

    Shared Services allows to configure the users/groups of products such as Shared Services, HFM, workspace, FDM, etc., etc., etc..

    In addition to the roles to users/groups; However, you will still perform security management in individual products.

    For example, in Shared Services, I can grant user johndoe rights to access an application of FDM. FDM, you would manage locations, the user can access, etc.

    Shared Services also enables other features such as safety reports and copy security/commissioning of an entire application to another App (for example, to create a new HFM application and then use Services shared to copy all the safety operation of an existing application that him)

  • What is the difference between a literal and a builder?

    (1) what is the difference between a literal and a builder?

    example:

    var someArray:Array = new Array(1,2,3); // Array constructor
    

    Nothing more than the ECMAScript abbreviation. You can do in JavaScript as well. The two objects are instances of the Array class.

    When you build a large matrix, you will appreciate the approach of stenography. It is much nicer to read. For example:

    var tileMapA:Array = [ [1, 1, 1, 1, 1],
                           [2, 2, 2, 2, 2],
                           [3, 3, 3, 3, 3] ];
    

    VS:

    var tileMapB:Array = new Array( new Array(1, 1, 1, 1, 1),
                                    new Array(2, 2, 2, 2, 2),
                                    new Array(3, 3, 3, 3, 3) );
    

    Not a huge difference immediately but expand the latter in much more complex nested table structures and you will clearly see the difference. It's the same thing for new Object() or simply {}.

Maybe you are looking for