2007 Apr 24 10:09 PM
Hello,
Which one is faster?
1. SELECT *
<b>INTO CORRESPONDING FIELDS OF TABLE W_TI_LQUA</b>
FROM ( LTBK AS C INNER JOIN LTBP AS B ON CTBNUM = BTBNUM )
WHERE BBESTQ ='Q' AND CMBLNR = WA_MBLNR.
or
2. SELECT f1 f2 f3
<b>INTO (W_TI_LQUA-f1, W_TI_LQUA-f2, W_TI_LQUA-f3)</b>
FROM ( LTBK AS C INNER JOIN LTBP AS B ON CTBNUM = BTBNUM )
WHERE BBESTQ ='Q' AND CMBLNR = WA_MBLNR.
Why?
Is it a way to improve this sql sentence performance??'
10nks!!
Gabriel
2007 Apr 24 10:21 PM
Hi,
<b>Option-2 is faster</b>. Since you are only reading the fields you are interested in, it reduce the network load and read will be fast. Also, when you use, INTO CORRESPONDING FIELDS OF TABLE, it is slower than INTO TABLE.
I would modify your second statement too. I assume that the structure of W_IT_LUQA is same as the fields you want to read from table.
2. SELECT f1 f2 f3
<b>INTO TABLE W_TI_LQUA</b>
FROM ( LTBK AS C INNER JOIN LTBP AS B ON CTBNUM = BTBNUM )
WHERE BBESTQ ='Q' AND CMBLNR = WA_MBLNR.
Regards,
RS
Hello,
Which one is faster?
1. SELECT *
<b>INTO CORRESPONDING FIELDS OF TABLE W_TI_LQUA</b>
FROM ( LTBK AS C INNER JOIN LTBP AS B ON CTBNUM = BTBNUM )
WHERE BBESTQ ='Q' AND CMBLNR = WA_MBLNR.
or
2. SELECT f1 f2 f3
<b>INTO (W_TI_LQUA-f1, W_TI_LQUA-f2, W_TI_LQUA-f3)</b>
FROM ( LTBK AS C INNER JOIN LTBP AS B ON CTBNUM = BTBNUM )
WHERE BBESTQ ='Q' AND CMBLNR = WA_MBLNR.
Why?
Is it a way to improve this sql sentence performance??'
10nks!!
Gabriel
2007 Apr 24 10:21 PM
Hi,
<b>Option-2 is faster</b>. Since you are only reading the fields you are interested in, it reduce the network load and read will be fast. Also, when you use, INTO CORRESPONDING FIELDS OF TABLE, it is slower than INTO TABLE.
I would modify your second statement too. I assume that the structure of W_IT_LUQA is same as the fields you want to read from table.
2. SELECT f1 f2 f3
<b>INTO TABLE W_TI_LQUA</b>
FROM ( LTBK AS C INNER JOIN LTBP AS B ON CTBNUM = BTBNUM )
WHERE BBESTQ ='Q' AND CMBLNR = WA_MBLNR.
Regards,
RS
2007 Apr 24 10:52 PM
select into corresponding is slower, Try to avoid as much as possible. To imporve the performance u should hit all key fields.
2007 Apr 25 5:58 AM
Hi,
the second statement is faster because:
its only selects the desired number of colums which reduces network traffic on the server. its also mentions the destination field names, so it becomes easy to map from source to destination.
Reward points if useful.
regards
vivek
2007 Apr 25 8:55 AM
Hi
the 2nd option is faster cuz of:
1.selecting only the required fields
2. avoiding INTO CORRESPONDING fields.
yes, it will definitely improve the performance.
Regards,
Madhumitha
2007 Apr 26 1:36 PM
Hai Gabriel Fernand,
AS into corresponding fields of option internally uses loops and so many comparisions,It works very slowly compared to second option.
So Socond option is better.
Hope you got some more reasons.
Reward points if it helps you.
Regds,
Rama chary.Pammi
2007 Apr 27 7:19 AM
Hi,
second statement is better as it selects only required fields.
Reward if useful.
Thanks,
USR
2007 Apr 27 2:36 PM
It doesn't matter which statement is faster. Both will be slow until you add LGNUM into the JOIN condition:
SELECT f1 f2 f3
INTO (w_ti_lqua-f1, w_ti_lqua-f2, w_ti_lqua-f3)
FROM ( ltbk AS c INNER JOIN
ltbp AS b ON
c~lgnum = b~lgnum AND
c~tbnum = b~tbnum )
WHERE b~bestq ='Q' AND c~mblnr = wa_mblnr.
Rob
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |