Does anyone know if it is more efficient to BULK collect a query, and then INSERT into the target table using FORALL..., or is the single statement INSERT INTO ...SELECT ... FROM ... more efficient?
My choice is INSERT..SELECT, because it's free from context switching. In general pure sql always beats pl/sql in performace. Though if you have rollback issues or need some intermediate processing you have to use pl/sql.
What do you mean by ”if you have rollback issues…”?
RBS is created based on DML on rows in the table – since the changes are the same (the result is the same – only the script is different) – the RBS is the same.
I agree with you that if possible always use pure DML statements – even if you have to “go around” because you can’t do it in one statement.
The Bulk… is some pl/sql situations where Oracle does it as pure as possible. And the speed is also fast.
I meant that if RB is not properly sized some extra time (quite large sometimes!) would be spent for expanding it to fit a large transaction. Another issue is disk space shortage. In this case if ACID is not a mandatory requirement, the whole work may be done in smaller batches (transactions) with the use of bulk operations.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.