Unix Technical Forum

multitable insert vs. normal inserts in a loop

This is a discussion on multitable insert vs. normal inserts in a loop within the Oracle Database forums, part of the Database Server Software category; --> i'd be grateful if someone could tell me what is faster: 1) 5 normal inserts to 5 different tables ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-24-2008, 09:35 AM
Kaly
 
Posts: n/a
Default multitable insert vs. normal inserts in a loop

i'd be grateful if someone could tell me what is faster:
1) 5 normal inserts to 5 different tables in a loop
2) 1 multitable insert in a loop

it has to look like:

1)
for v_qry in (select * from source_table) loop
insert into table_1 (p1,p2,p3,...) values (v1,v2,v3,...);
insert into table_2 (p1,p2,p3,...) values (v1,v2,v3,...);
insert into table_3 (p1,p2,p3,...) values (v1,v2,v3,...);
insert into table_4 (p1,p2,p3,...) values (v1,v2,v3,...);
insert into table_5 (p1,p2,p3,...) values (v1,v2,v3,...);

/* extra instructions */
end loop;

2)
for v_qry in (select * from source_table) loop
insert all into table_1 (p1,p2,p3,...) values (v1,v2,v3,...)
into table_2 (p1,p2,p3,...) values (v1,v2,v3,...)
into table_3 (p1,p2,p3,...) values (v1,v2,v3,...)
into table_4 (p1,p2,p3,...) values (v1,v2,v3,...)
into table_5 (p1,p2,p3,...) values (v1,v2,v3,...)
select * from source_table where id = v_qry.id;

/* extra instructions */
end loop;

and the solution without the loop is impossible to use 'cause i have
some extra instructions in it

thanks for any suggestions
And.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-24-2008, 09:35 AM
ana
 
Posts: n/a
Default Re: multitable insert vs. normal inserts in a loop

"Kaly" <akaliski@gazeta.pl> wrote in message
news:a3d58995.0412091127.2a91add@posting.google.co m...
> i'd be grateful if someone could tell me what is faster:


What is preventing YOU from doing your own testing?

SQL> SET TIME ON


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:42 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com