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

Sequential read

Former Member
0 Likes
4,928

Hi all,

I have got a request from the basis team to check why a particular program is doing a sequential read. How should i go ahead for the request. I am unable to find where the program is doing sequential reads. Can anyone tell me how to look for the select statements doing sequential read?

Thanks:

SIddharth

8 REPLIES 8
Read only

Former Member
0 Likes
3,684

Hi Kumar,

Sequential reads means particular report is poor, or its performance is not good. Hope your basis team might have given you the program name which is running sequential reads check the performance and do the relevant changes.

High check the below link how we have to consider the sequential reads in calculating total database time.

http://help.sap.com/saphelp_nw04s/helpdata/en/dc/6badf472b14caeba19741a160d4868/content.htm

Cheers!!

VEnk@

Edited by: Venkat Reddy on Oct 30, 2008 2:20 PM

Read only

h_senden2
Active Contributor
0 Likes
3,684

A sequential read means that the programs reads the database table or internal table very slow. It checks every record on the given conditions.

If you can make use of indexes the program will be significantly faster.

You have to ask the basis team for the program name and the db table or intenal tables with the sequential read.

regards,

Hans

Read only

Former Member
0 Likes
3,684

Ya i have got the program name and the table as well.

The table name is MSEG. when i look for all the queries done on MSEG table i find only 2.

they are listed below.

SELECT MBLNR MENGE EBELN EBELP BWART

FROM MSEG

INTO CORRESPONDING FIELDS OF TABLE T_MSEG

WHERE EBELN = V_EBELN

AND EBELP = V_EBELP

AND MBLNR < V_MBLNR

AND PARENT_ID = '000000'.

SELECT SINGLE MBLNR DMBTR BNBTR

INTO (T_SLIP-MBLNR, T_SLIP-DMBTR, T_SLIP-BNBTR)

FROM MSEG

WHERE MBLNR = T_EKBE-BELNR

AND WERKS = P_WERKS

What i believe is that the 1st query uses the option corresponding fiels and so this is causing a sequential read. Is there any transaction or a way from which i can confirm this.

Read only

0 Likes
3,684

INTO CORRESPONDING has nothing to do with sequential read. The problem with the first select is that no primary or secondary key is used to access MSEG. This causes a full table scan, which can be very slow.

The second select is not so critical, although not perfect either (SELECT SINGLE without specifying full primary key).

Thomas

Read only

Former Member
0 Likes
3,684

THanks.

OK, now i got it right.corresponding would only reduce the performance but it has nothing to do with sequential read.

Read only

Former Member
0 Likes
3,684

Hi,

Check transaction ST05 , to identify the performance of selects.

Thanks & Regards,

Navneeth K.

Read only

0 Likes
3,684

> corresponding would only reduce the performance

But only so much that you can usually ignore this effect (maybe 0,1% difference based on my own measurements). "corresponding" in Select- or Move-statements allows for some elegant programming techniques that I would not want to live without.

Thomas

Read only

Former Member
0 Likes
3,684

Hi,

The reason why it is sequential read because the query is not using any index and thus has to read each and every record sequentially and compare the fields of the where clause.

You are reading the MSEG table without using any index. If you know the PO number and the PO item, you also know the material number, plant and storage location of the PO item thus also check for the Material number, plant and storage location in the where clause. The query will then use the index MSEG~M and would improve the performance.


SELECT MBLNR MENGE EBELN EBELP BWART
FROM MSEG
INTO CORRESPONDING FIELDS OF TABLE T_MSEG
client specified
WHERE  mandt = sy-mandt
matnr = v_matnr   "MATNR from the Purchase order
werks = v_werks  " Plant from the purchase order
LGORT = v_lgort " Storage location from the Purchase order
EBELN = V_EBELN
AND EBELP = V_EBELP
AND MBLNR < V_MBLNR
AND PARENT_ID = '000000'.

If possible, do the same for the second query as well.

regards,

Advait.