In case of large statements, the R/3's database interface divides the statement into several parts and recombines the resulting set to one. The advantage here is that the number of transfers is minimized and there is minimal restrictions due to the statement size (compare with range tables).
SELECT * FROM TABLE
vs.
SELECT column(s) FROM TABLE
Use a select list or a view instead of SELECT *, if you are only interested in specific columns of the table. If only certain fields are needed then only those fields should be read from the database. Similarly, the number of columns can also be restricted by using a view defined in ABAP/4 Dictionary. Overall database and network load is considerably less.
SELECT without table buffering support
vs.
SELECT with table buffering support
For all frequently used, read-only(few updates) tables, do attempt to use SAP-buffering for improved
performance response times. This would reduce the overall Database activity and Network traffic.
Single-line inserts
LOOP AT INT-TAB
INSERT INTO TABLE VALUES INT-TAB
ENDLOOP
vs.
Array inserts
Whenever possible, use array operations instead of single-row operations to modify the database tables Frequent communication between the application program and database system produces considerable overhead
Single-line updates
SELECT * FROM TABLE
COLUMN-UPDATE STATEMENT
UPDATE TABLE
ENDSELECT
vs.
Column updates
UPDATE TABLE SET COLUMN-UPDATE STATEMENT
Wherever possible, use column updates instead of single row updates to update your database tables
DO....ENDDO loop with Field-Symbol
vs.
Using CA operator
Use the special operators CO, CA, CS instead of programming the operations yourself If ABAP/4 statements are executed per character on long strings, CPU consumption can rise substantially
Use of a CONCATENATE function module
vs.
Use of a CONCATENATE statement
Some function modules for string manipulation have become obsolete, and should be replaced by ABAP statements or functions
STRING_CONCATENATE... --- CONCATENATE
STRING_SPLIT... --- SPLIT
STRING_LENGTH... --- strlen()
STRING_CENTER... --- WRITE..TO. ..CENTERED
STRING_MOVE_RIGHT --- WRITE...TO...RIGHT-JUSTIFIED
Moving with offset
vs.
Use of the CONCATENATE statement
Use the CONCATENATE statement instead of programming a string concatenation of your own
Use of SEARCH and MOVE with offset
vs.
Use of SPLIT statement
Use the SPLIT statement instead of programming a string split yourself
Shifting by SY-FDPOS places
vs
Using SHIFT...LEFT DELETING LEADING...
If you want ot delete the leading spaces in a string use the ABAP/4 statements SHIFT...LEFT DELETING LEADING... Other constructions (with CN and SHIFT... BY SY-FDPOS PLACES, with CONDENSE if possible, with CN and ASSIGN CLA+SY-FDPOS(LEN) ...) are not as fast
Get a check-sum with field length
vs
Get a check-sum with strlen ()
Use the strlen () function to restrict the DO loop to the relevant part of the field, eg. when determinating a check-sum
Quick Note on Design of secondary database indexes
First it must be stated that table design is a more logical work while index design is rather technical. In table design it might make sense to place certain fields (client, company code, ...) in the beginning. In index design, this is not advisable. Very important for an index is that it contains very selective fields in the beginning. Those are fields like object numbers. Not selective are client, company code, ...
• Indexes should be small (few fields). The Database optimizer can combine two or more indexes to execute a query.
• Indexes of one table should be disjoint (have few common fields), in order not to confuse the optimizer which index to use.
Note that each index slows the inserts into the table down. Updates are only slowed down if indexed fields are updated. In general, heavy inserted tables should have only few indexes while heavy selected tables might have more.
Quick Note on Design of logical databases
Using logical databases is a good method to write reports. Logical databases can be optimized centrally. But ensure that the structure of the logical database fits well to your report. Otherwise the effect can be the opposite.
RELATED POSTS
EFFECTIVE CODING IN ABAP PART 1
SAP Financial Part Two
Customer Vendor Accounts
EnjoySAP Financial Invoice Entry
Automatic Payments
General Ledger Accounts
Customer and Vendor Accounts
SELECT * FROM TABLE
vs.
SELECT column(s) FROM TABLE
Use a select list or a view instead of SELECT *, if you are only interested in specific columns of the table. If only certain fields are needed then only those fields should be read from the database. Similarly, the number of columns can also be restricted by using a view defined in ABAP/4 Dictionary. Overall database and network load is considerably less.
SELECT without table buffering support
vs.
SELECT with table buffering support
For all frequently used, read-only(few updates) tables, do attempt to use SAP-buffering for improved
performance response times. This would reduce the overall Database activity and Network traffic.
Single-line inserts
LOOP AT INT-TAB
INSERT INTO TABLE VALUES INT-TAB
ENDLOOP
vs.
Array inserts
Whenever possible, use array operations instead of single-row operations to modify the database tables Frequent communication between the application program and database system produces considerable overhead
Single-line updates
SELECT * FROM TABLE
COLUMN-UPDATE STATEMENT
UPDATE TABLE
ENDSELECT
vs.
Column updates
UPDATE TABLE SET COLUMN-UPDATE STATEMENT
Wherever possible, use column updates instead of single row updates to update your database tables
DO....ENDDO loop with Field-Symbol
vs.
Using CA operator
Use the special operators CO, CA, CS instead of programming the operations yourself If ABAP/4 statements are executed per character on long strings, CPU consumption can rise substantially
Use of a CONCATENATE function module
vs.
Use of a CONCATENATE statement
Some function modules for string manipulation have become obsolete, and should be replaced by ABAP statements or functions
STRING_CONCATENATE... --- CONCATENATE
STRING_SPLIT... --- SPLIT
STRING_LENGTH... --- strlen()
STRING_CENTER... --- WRITE..TO. ..CENTERED
STRING_MOVE_RIGHT --- WRITE...TO...RIGHT-JUSTIFIED
Moving with offset
vs.
Use of the CONCATENATE statement
Use the CONCATENATE statement instead of programming a string concatenation of your own
Use of SEARCH and MOVE with offset
vs.
Use of SPLIT statement
Use the SPLIT statement instead of programming a string split yourself
Shifting by SY-FDPOS places
vs
Using SHIFT...LEFT DELETING LEADING...
If you want ot delete the leading spaces in a string use the ABAP/4 statements SHIFT...LEFT DELETING LEADING... Other constructions (with CN and SHIFT... BY SY-FDPOS PLACES, with CONDENSE if possible, with CN and ASSIGN CLA+SY-FDPOS(LEN) ...) are not as fast
Get a check-sum with field length
vs
Get a check-sum with strlen ()
Use the strlen () function to restrict the DO loop to the relevant part of the field, eg. when determinating a check-sum
Quick Note on Design of secondary database indexes
First it must be stated that table design is a more logical work while index design is rather technical. In table design it might make sense to place certain fields (client, company code, ...) in the beginning. In index design, this is not advisable. Very important for an index is that it contains very selective fields in the beginning. Those are fields like object numbers. Not selective are client, company code, ...
• Indexes should be small (few fields). The Database optimizer can combine two or more indexes to execute a query.
• Indexes of one table should be disjoint (have few common fields), in order not to confuse the optimizer which index to use.
Note that each index slows the inserts into the table down. Updates are only slowed down if indexed fields are updated. In general, heavy inserted tables should have only few indexes while heavy selected tables might have more.
Quick Note on Design of logical databases
Using logical databases is a good method to write reports. Logical databases can be optimized centrally. But ensure that the structure of the logical database fits well to your report. Otherwise the effect can be the opposite.
RELATED POSTS
EFFECTIVE CODING IN ABAP PART 1
SAP Financial Part Two
Customer Vendor Accounts
EnjoySAP Financial Invoice Entry
Automatic Payments
General Ledger Accounts
Customer and Vendor Accounts
No comments :
Post a Comment