Variable code bind takes longer time to complete?

Hello, my database is oracle11g.

I have same code plsql and the first is without bind variable and is second with bind variable. Usually the binding variable should take less time. But here
the binding variable takes more time than the standard code... Can someone please explain why?


SQL > alter system flush shared_pool;

Modified system.

SQL > declare
2 cursor c1 is select * from emp where rownum < 50;
3 l_start NUMBER DEFAULT DBMS_UTILITY. GET_TIME;
number of v_cnt 4;
5. start
6 because me looped c1
7. SELECT count (*) in v_cnt
8 RATE
9 WHERE IN (SELECT rate_id rate_id
10 FROM ratedetail
11 WHERE benefit_id = i.benefit_id)
12 AND effective_date =
13 to TO_DATE ('2011-01-23 00:00:00 ', "yyyy-MM-dd HH24:MI:SS")
14 AND rate_type_id = 1;
15 end loop;
16 DBMS_OUTPUT. Put_line ('total minutes...' |) ROUND (ROUND ((DBMS_UTILITY. GET_TIME - l_start) / 100, 2)
((/ 60,3));
end 17;
18.
total number of minutes... 06

PL/SQL procedure successfully completed.

SQL > alter system flush shared_pool;

Modified system.

SQL >
SQL > declare
2 cursor c1 is select benefit_id from emp where rownum < 50;
3 l_start NUMBER DEFAULT DBMS_UTILITY. GET_TIME;
number of v_cnt 4;
5. start
6 because me looped c1
7 execution immediate 'SELECT count (*)
8 RATE
9 WHERE IN (SELECT rate_id rate_id
10 FROM ratedetail
11 WHERE benefit_id =: x)
12 AND effective_date = trunc (sysdate)-202
13 AND rate_type_id = 1'
14 in v_cnt using i.benefit_id;
15 end loop;
16 DBMS_OUTPUT. Put_line ('total minutes...' |) ROUND (ROUND ((DBMS_UTILITY. GET_TIME - l_start) / 100, 2)
((/ 60,3));
end 17;
18.
total number of minutes... 061

PL/SQL procedure successfully completed.

SQL >

You are totally confused.
If a statement using bind variable is executed several times, it will only be parsed first.

Here is an example of not using bind variables

Select ename
WCP
where empno = 10;

Select ename
WCP
where empno = 20;

Oracle is two different statements will review and analyze the two of them.

Comes in cursor_sharing = force

Now the two statements will be, behind the scenes
is converted to
Select ename
WCP
where empno =: b1;

Only 1 analysis.

Cursor_sharing = force is a very rude to reduce the analysis.

When you use bind variables, not analytical, and you re - use the execution plan, which is not generated again.

HTH
------------------------
Sybrand Bakker
Senior Oracle DBA

Tags: Database

Similar Questions

  • Add & Remove programs - takes a long time to complete

    Whenever I go to add and remove programs, this message - please wait while the list is full and it takes longer and longer each time.

    Hi Lockeyp.23,

    I suggest to refer to the link provided below and check if the problem is resolved.

    Incorrectly, Add/Remove Programs tool displays installed programs
    http://support.Microsoft.com/kb/266668/en-us

    If the problem persists, try to clean boot

    How to configure Windows XP to start in a "clean boot" State
    http://support.Microsoft.com/kb/310353

    Note: after a repair, be sure to set the computer to start as usual in the article above.

    Thank you, and in what concerns:
    I. Suuresh Kumar - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • attempts to cancel the query discoverer - it takes long time to cancel...

    Hello world

    I cancelled a beak of query. It took a long time to run

    Now it takes a long time to cancel

    The admin is out to lunch...

    all advice, pls, thx, sandra

    Hi, Sandra
    In general, the reason for the cancellation of a query is that it has worked too long - right?

    Behind the scenes, one of two things happening, either:

    1. the request was to have a hard time finding data and is always looking, or
    2. the query found some data but not enough to satisfy the query governor parameters

    For these, depending on the amount of data has so far been recovered, discoverer must these data somewhere. This is called a cache. The data you put in a cache more must be allowed to come out it should you decide not to go forward. This is probably what has happened to you.

    Also, when you cancel a query you are generally posed a question about whether discoverer must keep the last change but does not return any data. If you click Yes in response to this question is usually what triggers the compensation of the cache. Most of the time I just click No, even if I made a little change. I tend to get my quick return query.

    Finally, if your discoverer worksheet is a crosstab or use Page elements, or even both at the same time, it is one of the causes of a long-running query. In these scenarios, discoverer has buckets to calculate and he has no idea how many buckets to until he has read all the data.

    My Discoverer 10 g manual and in my training I speak on the motion of The Twilight Zone. These are queries than ever or never looks back all the data and either expire or must be stopped manually. Sometimes these runaway queries trying to return each row of data in the database, but more generally, they are caused by the use of overcasual of page elements or tables double entry.

    Let us hope that this logbook help
    Best wishes
    Michael

  • SQL code take long time

    Hi all
    In Oracle 10 g, I have the emp_history table and the column name hired_date, which has the
    the values in the following format 08/07/2011 12:55:55
    ("mm/dd/yyyy hh12:mi: ss AM' ') ana this table has more than 50,000 documents.
    When I tried to get the employees including hired_date between 01/04/2011 and 04/30/2011
    its time consuming (16 to 19 minutes) just to go get 845 files.
    I tried the following codes,
     select * from emp_history where to_char(hired_date,'mmddyyyy') between
     04012011' and 04302011' and ...;
    and
      select * from emp_history where to_char(hired_date,'ddmmyyyy') between
     '01042011' and 30042011' and ....
    He saw somewhere else condition also but if I commented the above condition where only its working fine.
    If I know I'm taking a lot of time.

    Can someone tell me how to change the code.

    Thank you.

    Published by: Gurujothi on August 3, 2012 04:21

    Try:
    1. the column in the index.
    2. do not use the function in the where clause to the column.

  • Pavilion 10 TS F3F15UA #ABA: HP Pavilion 10 TS Notebook PC takes long time to start and does not

    I used the Windows Moviemaker app and suddenly the system became unstable and very slow. I tried to reboot several times. It takes about 15 minutes to restart the desktop and there is practically no response at all when I try to do anything on the machine. I am able to get Task Manager up and it shows 100% use of the disk.

    Should what steps I take to diagnose the problem?

    I'm tired of doing these steps on a computer that has worked less than 1% of the time so I just restored it from scratch and it seems to be ok now. I lost everything I had on this subject, but I can recreate it all by downloading things I need from the internet. Even make that a backup did not work as hard disk access was extremely slow or not available at all.

    Thanks for the help.

  • Nested set tables in select query "in the clause of" take long time

    create or replace type t_circuitids is table of the varchar2 (100);

    -Under anonymous block continues to run away and never ends

    DECLARE
    v_circuitid t_circuitids;
    number of v_count;
    l_circuitids VARCHAR2 (4000)
    : = "Value1, value2, value3, value4, Value5";
    BEGIN
    -Query below converts the output concatinated with commas to the list and stores it in the nested table collection v_circuitids
    WITH an ACE
    (SELECT ',' | l_circuitids |) ',' AS circuitid
    THE DOUBLE)
    SELECT DISTINCT TRIM (SUBSTR (circuitid,
    INSTR (circuitid, "," 1, LEVEL) + 1.
    INSTR (circuitid, "," 1, LEVEL + 1)
    -INSTR (circuitid, "," 1, LEVEL)
    -1
    )
    ) cid
    LOOSE COLLECTION v_circuitid
    A
    CONNECT BY LEVEL <
    LENGTH (circuitid)
    -LENGTH (REPLACE (circuitid, ','));

    SELECT COUNT (1)
    IN v_count
    TABLE
    WHERE name IN (SELECT COLUMN_VALUE
    TABLE (v_circuitid));
    END;
    /

    -I had the question, query "SELECT COLUMN_VALUE FROM TABLE (v_circuitid)" that is used in code above is responsible for this.

    -Same code works fine in development and Test environments, but prod it continues to work on

    -I solved this problem by creating a temporary table, loading of all values in the collection in the temporary table and using this temporary table "in the clause" "

    -Can answer why his behavior like this when I use the collection where clause?

    -I use Oracle 9i

    Here is a summary of the question and the solution for this.

    -Nested type to collect multiple values

    CREATE or REPLACE the TYPE t_circuitid IS TABLE OF VARCHAR2 (100);

    Below the code will simply on the run.

    DECLARE
    v_circuitid t_circuitid;
    v_count NUMBER;
    BEGIN
    SELECT nal_name
    LOOSE COLLECTION v_circuitid
    OF fs_head
    WHERE groupid = 10;

    SELECT COUNT (1)
    IN v_count
    OF fs_attrib
    WHERE NAME IN (SELECT COLUMN_VALUE
    TABLE (v_circuitid));

    Dbms_output.put_line (v_count);
    END;
    /

    Cause:-SELECT COLUMN_VALUE TABLE (v_circuitid)); -This request is causing problem

    Why?  : - Because the CBO does not know how many lines is present in the collection, by default it takes 8168 lines

    Note:-always happens, it depends on the volume of data in the table, the path chosen by CBO. In my case, the table is huge on prod compared to DEV so he was causing a problem.

    -The following modified code works very well

    DECLARE
    v_circuitid t_circuitid;
    v_count NUMBER;
    BEGIN
    SELECT nal_name
    LOOSE COLLECTION v_circuitid
    OF fs_head
    WHERE groupid = 10;

    SELECT COUNT (1)
    IN v_count
    OF fs_attrib
    WHERE NAME IN (SELECT / * + cardinality (20 t) * /)
    COLUMN_VALUE
    TABLE (v_circuitid) t);

    Dbms_output.put_line (v_count);
    END;
    /

    Solution:-used as cardinality hint below.

    SELECT / * + cardinality (20 t) * / t COLUMN_VALUE TABLE (v_circuitid);

    Using cadinality I am saying CBO which dataset contains 20 lines or less.

    If it is version of Oracle 10 g and more, we can use below code (CARD utility).

    SELECT COLUMN_VALUE TABLE (CARD ((v_circuitid))

    For more information reach me at [email protected]

    Thank you best regards &,.

    Amarnath a. Reddy.

  • My computer windows hp laptop Pavilion 8 takes long time to log in, why?

    Should I just turn off my laptop and start again or wait until it connects me to, but I don't know that it will be. He's been stuck on this welcome load when I login.

    Hi Daisycp,

    Welcome to the Forums of HP Support!

    I understand that your HP Pavilion computer is not boot up after the HP logo screen. I'll try my best to help you with this problem. To better orient, you please can you me the complete laptop computer model number and the operating system that runs on it. Here are a few guides for How can I find my model number or product number? and Windows operating system am I running?.

    In the meantime, here's a document to test a hard drive in the BIOS see if your hard drive is working properly.

    I hope that this helps, please let me know how it goes.

    Thank you and have a great day!

  • I just bought the Officejet Pro 8600 more. The sprint is all set up. But it takes long time

    between the sending to print and actually printing the file. Is there a way to speed it up?

    The printer is now connected to the computer via a wireless connection. The scanner works fine and report may be the printer from the printer LCD display. After completing all of the proposed tests now the printer reacts much more quickly. Maybe it's because I turned off the printer and turn it back on and the printer has been reset correctly print wireless. Thanks for the help.

  • I get this message when you try to start the firefox4 Script: chrome://tavgp/content/libs/include.js:595 and after clicking on ok, it takes long time for firefox open

    When I click on the firefox icon, the minutes pass and this is displayed: WARNING: unresponsive script: Script: chrome://tavgp/content/libs/include.js:595. iClick continue and again, after a minute or so firefox 4 starting ithen get a message: TypeError: components.classes['@ [cid] is undefined

    It is a problem with the AVG Safe Search toolbar.

    See:

  • BPEL variable, take the time to 1 min just for the assignment of value in the Assign activity

    Hi all

    We get a strange question in BPEL production environment.
    In the assign activity, there are 3 variable hardcoded with some default values.
    At runtime, a variable is to take more time from 1 minute to initialize just this default value.
    We do not get this problem of time in Dev and Test environments, so we are not able to test this.
    Please look in the Audit trail for the BPEL instance in the Production environment.
    Request to let me know if them work around or fix for this issue.



    Thanks in advance,
    Kumar

    Hello

    Yes, you can get to know the time for the verification that frm trail... u can also make use of activity sensors to calculate the exact time.

  • Video takes a LONG time

    Howdy, everyone. I am currently shopping around for a video editing application, and I'm using the trial version of Adobe Premiere Elements. I love everything about it so far, except for one thing. It takes a long time to save the final video file (from the tab share). I noticed he gets to 50% fairly quickly, probably within five minutes and at that time there the progress bar slows down to a crawl. It takes more than two hours for the last 50% complete. Is this rare or should I wait?

    Here's a little history of my project, in case this is useful.

    The video project is a little less than 30 minutes.

    On the sharing tab, I selected to export files for viewing on computers.

    The type of video I want is WMV (Windows Media). I can vary from this format. It is a requirement of the project.

    Image size: 1024 x 768. At the moment I can't vary that size. The video must be 1024 x 768.

    Frame rate: 30 fps

    Audio: mono 48 kbps, 44 kHz, CBR

    Codec: Windows Media 9

    Encoding Passes: 1

    Bitrate Mode: Constant (I also tried of Variable quality, but noticed no difference in time rendering)

    Maximum flow: 200 Kbps (the first time I tried 2 000 kbit/s, but I noticed no difference in time rendering)

    Image quality: 3 (I also tried 90 but once again without any perceptible difference when rendering time)

    My laptop:

    Windows XP Pro SP3

    Intel Core 2 Duo 2.2 GHz

    2 GB of RAM

    The window says that I would wait the video size to be 53MB in size, which seems reasonable. But when it finishes, it is more than ten times greater than this estimate. I don't understand why the file size is so big and the render time is so long.

    My rendering time is governed or strangled because I am using a trial version of Premiere Elements?

    If this is not the case, what suggestions you all for me? Am I be unreasonable while waiting for my render times to be faster than the duration of the video?

    Thanks in advance for your help. Please let me know if I can provide any other details.

    WMV is a highly compressed format/CODEC, and the duration of the treatment will depend on several factors:

    Your CPU, which is not as powerful in your case

    Your auxiliary I/o system, which is probably a single HDD on your laptop

    The source footage. What is your source footage?

    No effect added to the images. You have all the effects?

    Each of them will have an impact on the time required.

    The trial is that a single main limitation - watermark. Now, there are some components that need to be triggered, but are not tested, but they would not obvious with the import of your source footage, if it is a question.

    Good luck

    Hunt

  • XY graph sometimes takes a long time to update legend

    Hello

    I wrote a small piece of code that highlights (changes line width) the plot on the graph when we click a mouse on its name in the legend of the plot. The code works well except when I the legend scroll bar is visible and its position is not 0, then when I click on the name of the parcel, the chart takes a long time(>4s) to change the width of the plot on the legend. The plot on the graph is updated instantly. Its only the legend of the plot that takes a long time to get updated.

    I enclose the code here... Please, run it and see if you also see the same behavior.

    Thank you

    Ritesh

    Hi Ritesh,

    The patch of f2 is already released. http://www.NI.com/download/LabVIEW-development-system-2015/5656/en/

    We will inform you of the R & D of your first question, but unfoturnately we cannot provide information on future products releases.

    Kind regards

  • videos take a long time to buffer

    There are a few dat I could watch fine Inc. and now it will take a long time for the buffer viedo and still have problems

    Hello

    1. what operating system is installed on the computer?

    2. what version of web browser work?

    3. do the same thing happens with all the videos that you try to play?

    4. I think you are referring to the videos online?

    5. How do you try to play the video?

    If you use Internet Explorer and facing problems, watch videos online, then you can check out the link below:

    The video problems when you use Internet Explorer

    http://support.Microsoft.com/kb/2532294

    Note:

    There is no option within the operating system to increase the speed of buffering. Only way to increase the speed of buffering in some measure is to have a connection with a higher bandwidth. But note that as does you not an option of continuous play in CD or DVD.

    Another work around that I do personally is to pause the video to complete the buffering and watch the video once the buffering completed.

    I hope this helps!

  • desktop computer takes a long time to load after uninstall of netware

    Dear Pascal, recently, by chance, I installed the client service for Netware on my PC. He asked to restart the computer, and after reboot, logon screens became classic. I uninstalled netware by accessing the properties of LAN. I managed to restore logon screens using Microsoft resources available on the net. However, my PC now takes * for long time for the desktop icons and toolbar are displayed. I use Microsoft Windows XP Version 2002 SP3, Intel Core2Duo processor P8600 @2.40 Ghz with 2 GB of RAM on Lenovo Thinkpad R400. I understand that it is after uninstalling the netware client that my office is very very slow. Help me for a faster loading of the desktop computer. Best regards, Reba Shankar

    Hey Reba,

    Thanks for choosing Microsoft Community!

    You have reached the right forum. Try to solve this problem.

    If I understand correctly, you have some performance issues on windows XP computer.

     

    Let us try the following steps:

     

    Method 1: Any installed program must be uninstalled from Add and remove programs. You can just remove shortcuts from other places like LAN properties.

    Run the following fix - it to uninstall client services for Netware.

    Solve problems with programs that cannot be installed or uninstalled:

    http://support.Microsoft.com/mats/program_install_and_uninstall

     

    Method 2: See the following article:

     

    How to make a computer faster: 6 ways to speed up your PC:

    http://www.Microsoft.com/atwork/maintenance/speed.aspx#fBid=uQRRD6ZPxkC

     

    Important notes:

    ·         Running chkdsk on the drive if bad sectors are found on the disk hard when chkdsk attempts to repair this area if all available on which data can be lost.

    ·         The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

    Hope the helps of information. Don't answer if you need assistance, we will be happy to help you.

  • My CPU runs at 100% without no reason and programs take a long time to open.

    A FEW TIMES WHEN I TRYING TO OPEN A PROGRAM FOR EXPLORER MOMENT HE TAKES A LOT OF TIME IT OPENS

    original title: RUN MY CPU to 100% BY MOMENTS AND PROGRAM TAKES a long TIME TO LOAD what COULD BE WRONG

    Hello

     
    You can try the steps in the following link and check if it solves the problem:
     
    Important: Running chkdsk on the drive if bad sectors are found on the disk hard when chkdsk attempts to repair this area if all available on which data can be lost.
    Note: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.
     
    I hope this helps!

Maybe you are looking for