Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Will persistent class 'Get' Method used inside a loop impact performance?

Former Member
0 Likes
825

I am new to ABAP OOP, especially the 'Persistent Class'.

Hope SAP technical gurus could give me your advices, thanks very much!

I have an internal table with 50K records, for each record, I need to access the

loop at itab assigning <ls_tab>. "50k records

zca_**_pers=>agent->get_persistent_by_query(

i_par1 = <ls_tab>-field1

i_query = cl_os_system=>get_query_maanger( ) -> create_query(

i+filter = 'field1 = par1' ) ).

endloop

Will the get statement inside a loop impact performance? Thanks.

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
774

Hello,

If you check the system generated Agent(ZCA*) & Base(ZCB*) classes, the method GET_PERSISTENT_BY_QUERY( ) does a SELECT * on the table for which the Persistent mapping has been defined.

So i don't think it'll be a good idea to perform this operation inside a LOOP. 50k iternations is definitely a big NO!

Is there are specific reason you're persistent classes to access the DB? If not, i'll suggest revert back to Open SQL.

BR,

Suhas

Message was edited by: Suhas Saha

4 REPLIES 4
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
775

Hello,

If you check the system generated Agent(ZCA*) & Base(ZCB*) classes, the method GET_PERSISTENT_BY_QUERY( ) does a SELECT * on the table for which the Persistent mapping has been defined.

So i don't think it'll be a good idea to perform this operation inside a LOOP. 50k iternations is definitely a big NO!

Is there are specific reason you're persistent classes to access the DB? If not, i'll suggest revert back to Open SQL.

BR,

Suhas

Message was edited by: Suhas Saha

Read only

Former Member
0 Likes
774

Thanks Suhas,

Therefore I will do a multiple selection with GET_PERSISTENT_BY_QUERY, with sorted key, and inside the loop i will read table with sorted key. Thanks.

Read only

matt
Active Contributor
0 Likes
774

The persistence framework is not really appropriate when processing large volumes of data. Use OpenSQL instead.

Read only

Former Member
0 Likes
774

Thanks Matthew