Application Development and Automation 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: 
Read only

Selecting Data from a Buffered Table

Former Member
0 Likes
2,432

Hi Friends,

Can anyone help me on understanding...How to write select statement on a Buffered table and how data is retrieved from a buffered table. Also how do we clear the buffer through program?

Regards,

Pradeep Singh Dhadwal

Note : Correct answer will attract good reward points.

3 REPLIES 3
Read only

Former Member
0 Likes
1,201

HI,

Optimizing the load of the database

Using table buffering

Using buffered tables improves the performance considerably. Note that in some cases a stament can not be used with a buffered table, so when using these staments the buffer will be bypassed. These staments are:

Select DISTINCT

ORDER BY / GROUP BY / HAVING clause

Any WHERE clasuse that contains a subquery or IS NULL expression

JOIN s

A SELECT... FOR UPDATE

If you wnat to explicitly bypass the bufer, use the BYPASS BUFFER addition to the SELECT clause.

Use the ABAP SORT Clause Instead of ORDER BY

The ORDER BY clause is executed on the database server while the ABAP SORT statement is executed on the application server. The datbase server will usually be the bottleneck, so sometimes it is better to move thje sort from the datsbase server to the application server.

If you are not sorting by the primary key ( E.g. using the ORDER BY PRIMARY key statement) but are sorting by another key, it could be better to use the ABAP SORT stament to sort the data in an internal table. Note however that for very large result sets it might not be a feasible solution and you would want to let the datbase server sort it.

Avoid ther SELECT DISTINCT Statement

As with the ORDER BY clause it could be better to avoid using SELECT DISTINCT, if some of the fields are not part of an index. Instead use ABAP SORT + DELETE ADJACENT DUPLICATES on an internal table, to delete duplciate rows.

Read only

0 Likes
1,201

Hi,

My question was how to read data from a buffered database table? And how do we clear buffer after using it in the program?

Thanks,

Pradeep

Read only

0 Likes
1,201

You would read the data by using a normal SELECT, though as mentioned above using some statements will bypass the buffer.

As for refreshing the buffer after you've used it, the point is that you don't. After the first SELECT, the data remains in the buffer until the system decides to refresh it either because the buffered table has been changed in the database or because a certain period of time has elapsed since the last refresh. Some useful information here. [http://help.sap.com/saphelp_nw04/helpdata/en/aa/4734a00f1c11d295380000e8353423/content.htm]