Oracle parameter binding qualitative can practice

Source: Internet
Author: User

From the composition of the SGA of Oracle, it is highly recommended to use parameter bindings. Using parameter bindings makes it possible to use the share Pool efficiently, which can significantly improve performance by not having to harden the cached SQL.

The specific practice is as follows:

Sql>create table Test (a number (10));

Create a second stored procedure:

create or replace procedure p_test is
i number(10);
begin
i := 0;
while i <= 100000 loop
execute immediate ' insert into test values (' || to_char(i) || ')';
i := i + 1;
end loop;

commit;

end p_test;

Test is not bound with the parameter first:

After running p_test, spents 91.111 seconds

Then create a parameter-bound:

create or replace procedure p_test is
i number(10);
begin
i := 0;
while i <= 100000 loop
execute immediate ' insert into test values (:a)'
using i;
i := i + 1;
end loop;
commit;

end p_test;

After running p_test, spents 55.099 seconds.

From the above operating time can be seen, the difference between the two are 39.525%, visible, with no parameter binding in the performance of the difference is relatively large.

http://tb.blog.csdn.net/TrackBack.aspx?PostId=1416644

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.