Question

I have two databases A and B.
B have some tables that are to be copied to A without any manipulation on the data.

Each table having millions of records.

Which one will give better performance.

option 1:
1.create a dblink in A to B
2.Then create a procedure in A that bulk collects the data from each table in B
3.And then perform bulk binds to tables in A

option 2:
1.create a dblink in A to B
2.Simply to do insert into tables...select * from B_tables@dblink

Please give the reasons behind.

I think option 1 is better.(dont have any logic, but i feel simple inserts are always poor than bulk binds)

Was it helpful?

Solution

You don't need to use intuition for these issues. They're very simple to test.

However, the general rule is that if you can do something in pure SQL, then do it that way. It's going to be the fastest method because there is no context switch between SQL and PL/SQL. PL/SQL can only change data via SQL anyway, so even if PL/SQL is infinitely fast it cannot be faster than using pure SQL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top