‎2006 Aug 16 7:03 AM
Can somebody explain me which is the better option provided we have large data selection.
select * into table it_mara from mara.
or
select * appending table it_mara from mara package size 10000.
endselect.
Please tell me as i don't have large data in my development system.
‎2006 Aug 16 7:07 AM
select * into table it_mara from mara.
is better out of 2.
Try selecting only those fields which are required instead of using select *.
Cheers
VJ
‎2006 Aug 16 7:07 AM
Hi,
Go for second one
select * appending table it_mara from mara package size 10000.
endselect.
Regards
vijay
‎2006 Aug 16 7:07 AM
>
> select * into table it_mara from mara.
This is a better as it does not go through a limit and there is only one hit on the database
Regards,
Ravi
Note : Please mark all the helpful answes
‎2006 Aug 16 7:09 AM
Example
Addition
... PACKAGE SIZE n
Effect
Works like ... INTO wa, except that the selected data is not placed in the internal table itab line by line, but in packets of n lines. The old contents of itab are overwritten.
n <= 0 causes a runtime error.
Internally, n is placed in a type I field. Here, the usual conversion rules apply (see MOVE).
After leaving the processing loop, the contents of the internal table itab are undefined.
If the result of the selection is a table, the data is retrieved in a processing loop introduced by SELECT and concluded by ENDSELECT. The processing passes through the loop once for each line read.
‎2006 Aug 16 7:09 AM
the first option is better, if possible select only the fields which you need instead of selecting all the fields, if there is any where condition try to use the Index.
‎2006 Aug 16 7:09 AM
Hi Phani,
First check if you really need to select all fields of table MARA. If you just need a specfic number of records then you could use UP TO n ROWS in your select.
Hope this helps...
P.S. Please award points for useful answers.
‎2006 Aug 16 7:10 AM
What exactly is the differnce in database access when we use packet size?
‎2006 Aug 16 7:12 AM
Hi,
When you Use Packet size then in your case it will fetch 10000 records and then again starts from 10001to 20000 records. if you have millions of records then Packet size is better option.
Regards
vijay
‎2006 Aug 16 7:12 AM
hi,
It depends on the data.
If we are having less data, so for
Select * into table it_mara from mara.
If you are having huge amount of data.
Then we have to go for
Select * appending table it_mara from mara package size 10000.
Ex: If there is a select which executes for a long time, if this time is exceeding the limit of timeout., then we get data in packages.
Regards,
Sailaja.
‎2006 Aug 16 7:14 AM
hi,
When we are using packet size as 100 ,the system gets 100 records from the database for every loop. So, for getting every 100 records, it hits the database.
Regards,
Sailaja.
‎2006 Aug 16 7:30 AM
Hi,
If you don`t have too many records to be fetched, use select <fieldlist.......
1. Your first query fetches all records and make sure that the primary key of the table are addressed in where conditions.
2. By adding appending addition you append records into your internal table.
To ensure optimized code, use your select query with all key additions in the where clause, avoid endselect and only select fields which are needed instead of all fields.
Hope the info. is helpful, reward points if so.
Regards