Whenever we create database tables,we define what kind of buffering it should possess.If buffering is activated for a table,we should choose from one of three buffering types. Single record buffering is recommended when we access fewer records from large tables. Generic buffering is recommended for language-specific and client-specific tables. Full buffering is recommended for small tables which are read frequently and written rarely. Now,what are the optimization techniques we can use when we have large tables and where records are accessed very frequently. What type of buffering is recommended and how can we optimize our database tables for such situations. asked 11 Apr '12, 12:04 bobby |
Large tables with many accesses, like VBAP, MSEG, MARA, etc, are configured by SAP without buffering, so I suppose that no buffering is recommended for those cases. To optimize performance it is common to see in SAP application code the following: 1) Try to query the database for a group of records instead of doing multiple single record selects (it's much faster to select one time 1000 rows than to do 1000 selects of 1 row) 2) Cache the results of DB queries in some application global variables, and check that cache before doing another query to the database. This can reduce the number of queries done and make the code faster, but one needs to use internal table of the type hash tables, otherwise, if the internal tables becomes large, searching for a record in memory with normal tables can be much slower than going to the database. answered 12 Apr '12, 14:02 pedrolima ♦♦ I think caching results of db queries is same as single record buffering. Single-record buffering will load into the buffer only the records that are actually read. hey can you tell me how to cache the results of DB queries into application global variables.
(13 Apr '12, 03:54)
bobby
I posted an exemple below, hope it helps.
(22 Apr '12, 18:39)
pedrolima ♦♦
|
One example of caching db queries (just one of many standard functions that can be found in the system). In this case a STATICS variable is used, an alternative is to create the variable in the top include of the function group. In both cases the variable is kept in memory after the function execution.
answered 22 Apr '12, 18:38 pedrolima ♦♦ |