Professional Documents
Culture Documents
One more point to be noted here is of the select *. Often this is a lazy coding practice. When a programmer gives select * even if one or two fields are to be selected, this can significantly slow the program and put unnecessary load on the entire system. When the application server sends this request to the database server, and the database server has to pass on the entire structure for each row back to the application server. This consumes both CPU and networking resources, especially for large structures. Thus it is advisable to select only those fields that are needed, so that the database server passes only a small amount of data back. Also it is advisable to avoid selecting the data fields into local variables as this also puts unnecessary load on the server. Instead attempt must be made to select the fields into an internal table.
Recommended Select * from zcnfl where cntry like IN% and airln = LF. Endselect.
1. 2. 3. 4.
Select distinct Select for update Order by, group by, having clause Joins
Use the Bypass buffer addition to the select clause in order to explicitly bypass the buffer while selecting the data.
1. Duplicates are automatically removed from the resulting data set. Hence care should be 2. 3.
taken that the unique key of the detail line items should be given in the select statement. If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty. If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.
Not Recommended Loop at int_cntry. Select single * from zfligh into int_fligh where cntry = int_cntry-cntry. Append int_fligh. Endloop. Recommended Select * from zfligh appending table int_fligh For all entries in int_cntry Where cntry = int_cntry-cntry.