Setting a value for LIMIT while using bulk collect

a 夏天 提交于 2019-11-28 10:36:16

Use an implicit cursor in a cursor FOR LOOP. It makes the code simpler and the default value of 100 is almost always good enough.

I've seen a lot of people waste a lot of time worrying about this. If you think about why bulk collect improves performance you will understand why large numbers won't help.

Bulk collect improves performance by reducing the context switches between SQL and PL/SQL. Imagine the highly-unlikely worst case scenario, where context switching uses up all the run time. A limit of 2 eliminates 50% of the context switches; 10 eliminates 90%; 100 eliminates 99%, etc. Plot it out and you'll realize it's not worth finding the optimal limit size:

Use the default. Spend your time worrying about more important things.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!