SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

INTO CORRESPONDING FIELDS OF TABLE vs INTO TABLE



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
XXX_:)
Аналитик
Аналитик


Age: 40
Joined: 01 Feb 2008
Posts: 387
Location: Воронеж

PostPosted: Wed Sep 30, 2009 4:36 pm    Post subject: INTO CORRESPONDING FIELDS OF TABLE vs INTO TABLE Reply with quote

Добрый день, есть вопрос. Есть ли выигрыш в производительности INTO TABLE перед INTO CORRESPONDING FIELDS OF TABLE. Или в чем INTO TABLE лучше, чем INTO CORRESPONDING FIELDS OF TABLE?
_________________
Hормальные люди делают вещи намного более безумные чем всё, что делают сумасшедшие (c) С.Лем
Back to top
View user's profile Send private message Blog
ppeter
Участник
Участник



Joined: 29 Oct 2008
Posts: 15

PostPosted: Wed Sep 30, 2009 4:56 pm    Post subject: Re: INTO CORRESPONDING FIELDS OF TABLE vs INTO TABLE Reply with quote

Вот нашел интересный примерчик:

XXX_:) wrote:

Added by Srihari Hebbar , last edited by Srihari Hebbar on Oct 04, 2007

A recent query on SDN prompted me to post this. The question was about whether an INTO CORRESPONDING FIELDS OF addition in a select statement will make significant difference to the selection time.

I decided to write a small piece of code to compare the run-time of two selects and compare them.

REPORT ZTEST_SELECT.


DATA: IT_BSEG TYPE TABLE OF BSEG.
DATA: t1 TYPE i,
t2 type i,
t3 type i,
t4 type i,
t0 type i.

*first select
GET RUN TIME FIELD t1.
SELECT * FROM BSEG
INTO CORRESPONDING FIELDS OF TABLE IT_BSEG
BYPASSING BUFFER.
GET RUN TIME FIELD t2.

*second select
GET RUN TIME FIELD t3.
SELECT * FROM BSEG INTO TABLE IT_BSEG
BYPASSING BUFFER.
GET RUN TIME FIELD t4.

t0 = t2 - t1.
write: 'INTO CORRESPONDING ', t0.
t0 = t4 - t3.
write: 'NORMAL', t0.

The results were as follows: INTO CORRESPONDING 4,476,553

NORMAL 831,611

I reversed the order of the selects to check if that makes a difference :

INTO CORRESPONDING 1,221,872

NORMAL 940,790

The number of entries in the table were around 17,000.

Therefore defining a structure exactly as per the select statement is seems to be better than the one where you use INTO CORRESPONDING FIELDS OF.
Back to top
View user's profile Send private message
ppeter
Участник
Участник



Joined: 29 Oct 2008
Posts: 15

PostPosted: Wed Sep 30, 2009 5:27 pm    Post subject: Reply with quote

проверил самостоятельно - действительно into corresponding примерно в 1,5 раза дольше отрабатывает. Думаю имеет смысл использовать только при выборке из join'ов.
Back to top
View user's profile Send private message
Dmitriy
Аналитик
Аналитик


Age: 46
Joined: 14 Nov 2008
Posts: 300
Location: Russia

PostPosted: Wed Sep 30, 2009 5:49 pm    Post subject: Reply with quote

А еще замерьте в таблицу какого типа быстрее: STANDART или SORTED with unique key... Wink
_________________
ABAP/4 You
Back to top
View user's profile Send private message
Удав
Гуру
Гуру


Age: 48
Joined: 25 Jan 2008
Posts: 580
Location: Москва

PostPosted: Thu Oct 01, 2009 12:26 am    Post subject: Reply with quote

ppeter wrote:
проверил самостоятельно - действительно into corresponding примерно в 1,5 раза дольше отрабатывает. Думаю имеет смысл использовать только при выборке из join'ов.

Выборка из BSEG в данном случае не показательна т.к. на самом деле на уровне БД считывается таблица rfblg.
Попробуйте выборку из BSIS вместо BSEG, к примеру.
И указывайте не select *, а десяток-другой полей Wink

При join вообще лучше select * не использовать. См. рекомендации SAP

_________________
С уважением,
Удав.
Back to top
View user's profile Send private message
XXX_:)
Аналитик
Аналитик


Age: 40
Joined: 01 Feb 2008
Posts: 387
Location: Воронеж

PostPosted: Thu Oct 01, 2009 3:24 pm    Post subject: Reply with quote

Dmitriy wrote:
А еще замерьте в таблицу какого типа быстрее: STANDART или SORTED with unique key... Wink

Так в какую же?

_________________
Hормальные люди делают вещи намного более безумные чем всё, что делают сумасшедшие (c) С.Лем
Back to top
View user's profile Send private message Blog
vga
Мастер
Мастер


Age: 190
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Thu Oct 01, 2009 3:42 pm    Post subject: Reply with quote

XXX_:) wrote:
Dmitriy wrote:
А еще замерьте в таблицу какого типа быстрее: STANDART или SORTED with unique key... Wink

Так в какую же?


Конечно STANDART Smile
Back to top
View user's profile Send private message Blog Visit poster's website
XXX_:)
Аналитик
Аналитик


Age: 40
Joined: 01 Feb 2008
Posts: 387
Location: Воронеж

PostPosted: Thu Oct 01, 2009 3:51 pm    Post subject: Reply with quote

а я уж смутился, думал какая то фича есть при выгрузке в SORTED Smile
_________________
Hормальные люди делают вещи намного более безумные чем всё, что делают сумасшедшие (c) С.Лем
Back to top
View user's profile Send private message Blog
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.