‎2012 Dec 28 5:39 AM
Dear Friends,
I would like to know that
Using of cursor in abap programming, does it make any issues related to performance and memory management
rather then any normal query ?
also like to know more about internal mechanism.
Avirat
‎2012 Dec 28 12:13 PM
Well,
using PACKAGE SIZE you can control some of the memory requirements when processing a result set. As far as performance is concerned, there should be no difference, because internally the DB always uses a cursor. The statement is "parsed", which means the DB decides about how to retrieve the resultset in the most efficient way. Then the cursor is opened and the result is fetched.
When you do SELECT / ENDSELECT, you can think of this a a special cursor with a package size of one. When you do a SELECT INTO ITAB, it is a package size of the full result set. So a programmed cursor is somewhat in between, because you can twist the package size.
If you require to use a DB-commit inside a loop, you can use a CURSOR WITH HOLD.
A normal cursor is closed on a commit. This is helpfull in some cases, as far as locks or UNDO resources are concerned.
Volker
‎2012 Dec 28 12:13 PM
Well,
using PACKAGE SIZE you can control some of the memory requirements when processing a result set. As far as performance is concerned, there should be no difference, because internally the DB always uses a cursor. The statement is "parsed", which means the DB decides about how to retrieve the resultset in the most efficient way. Then the cursor is opened and the result is fetched.
When you do SELECT / ENDSELECT, you can think of this a a special cursor with a package size of one. When you do a SELECT INTO ITAB, it is a package size of the full result set. So a programmed cursor is somewhat in between, because you can twist the package size.
If you require to use a DB-commit inside a loop, you can use a CURSOR WITH HOLD.
A normal cursor is closed on a commit. This is helpfull in some cases, as far as locks or UNDO resources are concerned.
Volker
‎2012 Dec 28 12:27 PM
Thank you Volker,
appreciate your answer.
but require more knowledge in depth if you have any resource .
Avirat
‎2012 Dec 28 12:31 PM
More knowledge about
- programming cursors in ABAP
or
- how cursors are processed by the DB
??
I guess you already did search help.sap.com for information like this ?
http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3b23358411d1829f0000e829fbfe/content.htm
Volker
‎2012 Dec 28 12:41 PM
ohh..
I have done this before (with the same link).
need to know about 2nd op.
ok anyway..
thank for your help.
Avirat
‎2012 Dec 28 1:01 PM
There might be slight technical differences depending on your DB type.
So I'd recommend to do a google search i.e. with
"cursor processing oracle" or "db2", or ...
depending on the DB you are running.
Volker
‎2012 Dec 29 6:13 AM