Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

buffering

Former Member
0 Kudos

hi to all abap gurus

my querry is as follows what is buffer ? and when do we buffer the table ?

how do we decide wether the table has tio be buffered or not ?

we know that all bufeering types 1 full buffering , 2. single record buffering .3.generic buffering .

buffering techniques 1.buffering allowed

2. buffering allowed but switched off

what r the differences between buffering types and buffering techniques

pls give the anser in detail points woll be rewarded definitely

3 REPLIES 3

Former Member
0 Kudos

Hi

Everytime there is no need for the system to fetch the data from the database tables

During runtime it creates some temporary memory like thing and keeps that fecthed records in a Buffer like thing and next time when you try to fetch the data at run time first it checks for the run time buffer is there or not, if it is there it takes the data from that buffer, instead of bring from database

see the concepts of buffering

We have 3 types of buffering

There are the following types of buffering:

o single-record buffering

o generic area buffering

o full buffering

Single-record buffering should be selected when :

o For large tables where there are frequent single-record accesses (using SELECT SINGLE ...). The size of the records being accessed should be between 100-200 KB.

o For comparatively small tables for which the access range is large, it is normally advisable to opt for full buffering. Only one database access is required to load such a table for full buffering,

while single-record buffering calls for a very large number of table accesses.

And also check this matter.

Single-record buffering: Only the records of a table that are really accessed are loaded into the buffer

Single-record buffering should be used particularly for large tables where only a few records are accessed with SELECT SINGLE. The size of the records being accessed should be between 100 and 200 KB.

Full buffering is usually more suitable for smaller tables that are accessed frequently. This is because only one database access is necessary to load such a table with full buffering, whereas several database accesses are necessary for single-record buffering.

Check this link :

http://help.sap.com/saphelp_nw04/helpdata/en/f7/e4c5a8a84a11d194eb00a0c929b3c3/content.htm

<b>Reward points</b>

Regards

Former Member
0 Kudos

Hi,

Whenever an Open SQL statement is used to read a record,

the data buffer is checked first to see whether it is there. If not, the data is read from the database.

If the table's attributes indicate that the data should be buffered, the record is saved in RAM on the application server in data buffers.

Later, if that record is read again, it is read from the buffer instead of the database.

By buffering data, you increase performance in two important ways:

The programs using the buffered data run faster because they don't have to wait for it to come from the database. This reduces delays waiting for the database and the network that connects it.

The other programs that need to access the database run faster because there is less load on the database and less traffic on the network.

Three types of buffering are possible:

<b>Full buffering

Generic buffering

Single-record buffering</b>

Although you use a check box to indicate the buffering type, only one type can be selected at a time. If you choose more than one, an error message will be displayed.

There are two data buffers on each application server, and the buffering type chosen determines which buffer is used. On an application sever there are:

The generic record buffer

The single-record buffer

The generic record buffer is called TABL (short for "table"). The single-record buffer is TABLP ("P"' stands for "partial").

<u><b>Full Buffering:</b></u>

To activate the full buffering type, tickmark the Full check box.

When an attempt is made to read data from a fully buffered table,

the system looks in the TABL buffer for it.

If it is not found there, all rows are loaded from the database into TABL .

This happens whenever a select statement for it is executed, no matter how many records match the where clause.

Even if no records match, all are loaded into the buffer if the table is not already there or

if it has been invalidated due to buffer synchronization.

Loading of TABL does not occur with select single statements; only select/ endselect does this.

If the table is fully buffered and a select single statement is executed, no records are loaded into TABL.

However, if the table is already loaded into TABL, select single will read records from it.

During buffer synchronization, the entire table is invalidated if any record within it changes. The next time data is read the entire table is reloaded.

Full buffering is appropriate for small tables that seldom change.

<u><b>Generic Buffering:</b></u>

With generic buffering, a group of records is loaded into TABL instead of the entire table.

To activate this type of buffering, tickmark the Generic check box

and put a number n in the No. of Key Fields so that the n left-most fields of the primary key will group records.

When a record is read and n is 1, all records having the same value

in the first field of the primary key are loaded into the buffer.

When a record is read and n is 2, all records having the same value in the first two fields of the primary key are loaded

into the buffer.

Generic buffering is suitable for tables in which records are usually accessed in sets or groups.

<u><b>Single Record Buffering:</b></u>

With this type of buffering, select single picks one record into the single record buffer TABLP.

With this buffering type, records are only buffered when the select single statement is executed.

Select/endselect does not load or read TABLP.

Single-record buffering is appropriate for very large tables in which a small percentage of the records are read often.

For single-record buffering to work, records must be read using the select single statement.

There are two buffers: <b>TABL</b> (the generic record buffer) and <b>TABLP</b> (the single record buffer).

There are also two varieties of the select statement: select and select single. The select statement loads TABL and the select single statement loads TABLP.

When reading, select only reads TABL; it ignores TABLP. select single reads both buffers. This behavior is summarized in Figure 5.20. Remember that a record can only be in one buffer at a time because a table can only have one buffering type.

<b>When should single-record buffering be selected?</b>

o For large tables where there are frequent single-record accesses

(using SELECT SINGLE ...). The size of the records being accessed

should be between 100-200 KB.

o For comparatively small tables for which the access range is large,

it is normally advisable to opt for full buffering. Only one

database access is required to load such a table for full buffering,

while single-record buffering calls for a very large number of table

accesses.

<b>When should generic buffering be selected?</b>

o A table should be buffered generically if usually only certain areas

of the table are required. The individual generic areas are treated

like independent tables that are fully buffered. Refer also to the

text on complete buffering.

o The generic key area should be selected so that the generic areas

are not too small to prevent too may generic areas being produced.

If there are only a few records for each generic area, it is more

efficient to use full buffering.

o Generic buffering only makes sense if the table is accessed by a

specified generic key. If, when an access takes place, a field of

the generic key is not supplied with a value, the buffer is ignored

and the records are read directly from the database.

o Language-specific tables are an example of good use of generic

buffering (with the language key field as generic key area).

<b>When should you select full buffering?</b>

o For tables up to 30 KB in size. If a table is accessed frequently,

but all accesses are read accesses, this value can be exceeded.

o For larger tables where large numbers of records are frequently

accessed. However, if the application program is able to formulate

an extremely selective WHERE condition using a database index, it

may be advisable to dispense with full buffering.

o For tables with frequent accesses to data not contained in the

table. Since all records are contained in the buffer, a quick

decision can be made as to whether or not the table contains a

record for a specific key.

Check this link :

http://help.sap.com/saphelp_nw04/helpdata/en/f7/e4c5a8a84a11d194eb00a0c929b3c3/content.htm

I hope it helps.

Regards,

Padmam.<u></u>

Former Member
0 Kudos

hi,

Buffering a table improves the performance when accessing the data records contained in the table.

The table buffers reside locally on each application server in the system. The data of buffered tables can thus be accessed directly from the buffer of the application server. This avoids the time-consuming process of accessing the database.

follow this link for more information.

http://help.sap.com/saphelp_webas620/helpdata/en/cf/21f244446011d189700000e8322d00/frameset.htm

regards,

Ashok Reddy