[Practical] Hints optimization of ABAP "FOR ALL ENTRIES"

Hints optimization of ABAP "FOR ALL ENTRIES"

 

Normally by default, the " FOR ALL ENTRIES IN " statement will generate a new Where statement for every 5 data in the internal table to execute.

The parameter name " rsdb/ max_blocking_factor " can be queried through the transaction code " RZ11 ", as shown in the figure below.

 

For example, the following code (for testing only):

REPORT ZTEST.
DATA : BEGIN OF LT_KNA1 OCCURS 0,
         KUNNR TYPE KNA1-KUNNR,
       END OF LT_KNA1.
DATA : LT_KNB1 LIKE TABLE OF KNB1 WITH HEADER LINE.
START-OF-SELECTION.
  SELECT * FROM KNA1
    INTO CORRESPONDING FIELDS OF TABLE LT_KNA1.
  IF LT_KNA1[] IS NOT INITIAL.
    SELECT * FROM KNB1
      INTO TABLE LT_KNB1
      FOR ALL ENTRIES IN LT_KNA1
      WHERE KUNNR = LT_KNA1-KUNNR.
  ENDIF.
  WRITE : 'Finish!'.

After tracking the execution with the transaction code " ST05 ", we can find that the default is indeed to read five data in the internal table.

 

In order to reduce the interaction with the database and reduce the number of Select statements, we can add such a sentence at the end of the Select statement, and the data read each time will change.

%_HINTS ORACLE '&max_blocking_factor 20& &max_in_blocking_factor 20&'

(Note that if it is a HANA database, it needs to be replaced with %_HINTS HDB)

 

However, setting rsdb/max_blocking_factor too large may make the SQL too long and cause the program to DUMP, so the setting needs to be cautious.

 

【Extended Learning】

  • rsdb/MB_CUR_MAX
  • rsdb/_create_single_client_cond
  • rsdb/cua/buffersize
  • rsdb/cua/max_objects
  • rsdb/cua/mutex_n
  • rsdb/db2jcl_library
  • rsdb/dbhost
  • rsdb/dbid
  • rsdb/esm/buffersize_kb
  • rsdb/esm/large_object_size
  • rsdb/esm/max_objects
  • rsdb/esm/mutex_n
  • rsdb/fda_level
  • rsdb/fda_shm_seg_size
  • rsdb/icli_library
  • rsdb/max_blocking_factor
  • rsdb/max_in_blocking_factor
  • rsdb/max_union_blocking_factor
  • rsdb/min_blocking_factor
  • rsdb/min_in_blocking_factor
  • rsdb/min_union_blocking_factor
  • rsdb / float / entrycount
  • rsdb / ntab / ftabsize
  • rsdb / float / irbdsize
  • rsdb / float / sntabsize
  • rsdb/obj/buffersize
  • rsdb/obj/large_object_size
  • rsdb/obj/max_objects
  • rsdb/obj/mutex_n
  • rsdb/oracle_host_standby
  • rsdb/oracle_sid_standby
  • rsdb/otr/buffersize_kb
  • rsdb/otr/max_objects
  • rsdb/otr/mutex_n
  • rsdb/prefer_fix_blocking
  • rsdb/prefer_in_itab_opt
  • rsdb/prefer_join
  • rsdb/prefer_join_with_fda
  • rsdb/prefer_union_all
  • rsdb/rclu/opt_level
  • rsdb / rda
  • rsdb/reco_add_error_codes
  • rsdb/reco_ping_cmd
  • rsdb/reco_sleep_time
  • rsdb/reco_sosw_for_db
  • rsdb/reco_sync_all_server
  • rsdb/reco_tcp_service
  • rsdb/reco_trials
  • rsdb/rep/fast_touch
  • rsdb/ssfs_connect
  • rsdb / staton
  • rsdb / stattime
  • rsdb/supports_fda_prot
  • rsdb/tbi_buffer_area_MB
  • rsdb / tbi_dir_entries
  • rsdb/trace_modules
  • rsdb/vmcj/codepage_compatibility

 

Guess you like

Origin blog.csdn.net/zhongguomao/article/details/108759495