Solved

performance tunning sql insert - challenging one

Posted on 2016-10-07
2
46 Views
Last Modified: 2016-10-07
I have an insert statement which is  used to insert around 9 million records, I want your guidance in tunning this process. Which is better a plsql procedure or insert statement

INSERT /* + append */ into consumer
Select *
from tmp_consumers  b
where  not exists (select 1 from consumerdata c
                                where c.prodcode=b.prodcode
                                and c.city=b.city)
0
Comment
Question by:sam_2012
2 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 500 total points
ID: 41834346
sql statement alone is better.

using pl/sql  you'll have to the same sql to perform the insert and select, but on top of that, you have the pl/sql overhead itself.

thing about it this way - you can perform step A, or you can perform step A + step B
No matter how small B is (unless 0, which is impossible) A alone will always be faster.


as a side note - please don't tag the questions "challenging" it's just extra characters that don't really add value in describing the problem.
0
 

Author Closing Comment

by:sam_2012
ID: 41834433
awesome.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question