Jump to content

Perf _ Insert into select Vs ForAll

Recommended Posts

I need to perform db operations where I need to simple inserts data from another query:


As of now I am using INSERT INTO SELECT inside apl/sq package.

but some time I am observing for same data set this queries takes more time 

Will For All perform better tan insert into select

Share this post

Link to post
Share on other sites

Hi Manish, and welcome to the forum!

The “insert select into” is native SQL, and there is no need for any PL/SQL:

insert /*+ append */ into
   select name, salary from emp where dept = ‘FINANCE’;

It is basically a SQL subquery, and if you suspect varying response times you need to examine the execution plans to insure that they are the same:


You can always use SQL profiles or optimizer plan stability to “freeze” the execution plans:


Please check and see if your plans are changing.

Some folks use temporary tables in lieu of a insert subquery:


As to using FORALL, sometimes that can help:


Please let us know about you execution plans and options!

Good luck!


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now