Problem with cursor in store procedure !
Our developer wrotten store procedure. This store use cursor to retrieve multiple rows (about 370.000 records). It take about 12 hours to complete.
I have been reviewing and trying tune to improve perfomance with some tasks:
- Use BULK COLLECT and LIMIT
- Use dynamic SQL + bind variable inside cursor.
- Reduce operations not needed inside cursor.
But it take about 11 hours to complete. I think that cause from cursor contained multiple records and it consume alot of resources ! I have been thinking about VARARRAY to replace cursor but with about 370.000 records, is it good solution ?
Can anyone give me some advise for my problem ? My db is 9.2.0.4 64 bit on AIX 5.3.