【发布时间】:2018-08-17 09:45:04
【问题描述】:
我想知道什么通常更快:
- 过滤掉重复项,然后进行选择
或 - 直接选择重复项
我认为它可能是第一个,但我不知道 -
如何在我的代码中很好地有效地集成删除重复项?
DATA:
lt_itab TYPE TABLE OF string,
lt_range_itab TYPE RANGE OF string
.
* Populating itab with duplicates
* Can the following somehow become a neat one-liner? This is ugly!
APPEND '1' TO lt_itab.
APPEND '2' TO lt_itab.
APPEND '2' TO lt_itab.
APPEND '3' TO lt_itab.
APPEND '4' TO lt_itab.
APPEND '4' TO lt_itab.
*Populating range table from itab
*Should one remove the duplicates here for a performance boost in the upcoming select?
*If so - how?
*-------------------------------------------------------
lt_range_itab = VALUE #(
FOR <ls_itab> IN lt_itab
( sign = 'I'
option = 'EQ'
low = <ls_itab> )
).
*...or is such a select usually faster than the time it takes to remove the duplicates?
*-------------------------------------------------------
*SELECT *
* FROM anyTable
* INTO TABLE @DATA(lt_new_data)
* WHERE anyProperty NOT IN @lt_range_itab.
【问题讨论】:
标签: performance abap