‎2009 Oct 27 6:58 AM
Hi ,
i have written a select statement plz suggest , is it a good practise to write it in the given below format will it affect the performance.
SELECT * INTO CORRESPONDING FIELDS OF TABLE ZBSIS
FROM BSIS
WHERE BUDAT IN BUDAT
AND HKONT IN
( SELECT SAKNR FROM ZTABLE_FLOW WHERE GSBER IN GSBER )
‎2009 Oct 27 7:05 AM
HI,
Definatly it will affect the performance.
1. Dont use nested Select statement instead use For All entries.
2. Dont Use corresponding fields in your select statement. Select only required fields and use an internal table of that type only.
I hope i am clear to you.
‎2009 Oct 27 7:02 AM
Hi,
Please try to avoid nested select statement. The reason is
"A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. You should therefore only use nested SELECT loops if the selection in the outer loop contains very few lines"
Thanks
venkat
‎2009 Oct 27 7:03 AM
Using a sub query doesn't have any performance loop holes.
I think you are going the right way.
Regards,
Abhinab Mishra
‎2009 Oct 27 7:05 AM
HI,
Definatly it will affect the performance.
1. Dont use nested Select statement instead use For All entries.
2. Dont Use corresponding fields in your select statement. Select only required fields and use an internal table of that type only.
I hope i am clear to you.
‎2009 Oct 27 7:06 AM
Hi,
ITS NOT A GOOD PRACTICE AT ALL..
go with individual selects.. if just 2 tables ur using then go with for all entries..
dont go with corresponding fields it will take time.. so use the field references while passing the data
‎2009 Oct 27 7:07 AM
Hi,
It will affect the performance if number of records are more.
Suggestion is: Dont use Select * in place of it write down the field names and also try to avoid corresponding fields of table as well.....just map the fields accorind to your Internal table structure.
After Fetching the data, Sort the table with your primark eys so that if you are fetching another talbes baed on previos one then performance will be good.
Please confirm if it clears your doubt and appreciate me for the same.
Regards
Sachin
‎2009 Oct 27 7:07 AM
Hi ,
some performane tips for select :
1) Avoid use of select * , instead give the specified fields u want to select
2) Avoid the nested select.
3) Select with index support.
4) If u need to select data from two table , then use for all entries .
Thanks
Shambhu
‎2009 Oct 27 7:07 AM
Hi,
ITS NOT A GOOD PRACTICE AT ALL..
go with individual selects.. if just 2 tables ur using then go with for all entries..
dont go with corresponding fields it will take time.. so use the field references while passing the data