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: 

DISK Read

Former Member
0 Kudos

we are getting very high disk read in some of our Queries but after seeing those queries there is nothing to optimise in these, but our BASIS people says that these queries are tking high disk reads, can any one sugges the possible way how to resuce the disk reading in those queries

abhishek suppal

9 REPLIES 9

former_member221770
Contributor
0 Kudos

Can you tell us more about these queries? It's a bit difficult to diagnose this issue without any examples. From the top of my head, maybe you could create some indexes for your tables?

But if you could tell us more about your queries then maybe we can give you some more specific ideas.

Cheers,

Pat.

0 Kudos

dare Pat,

as reqd. by u, pl. see this these are the few queries...

SELECT SUM( gmnga ) INTO v_gmnga

FROM afru

WHERE budat = p_date AND

ile02 = 'KWH' AND

aufnr = i_ord-aufnr AND

stokz <> 'X' AND

stzhl = init_stzhl.

********************************************

SELECT prueflos merknr vorglfnr masseinhsw verwmerkm

INTO CORRESPONDING FIELDS OF TABLE i_qamv

FROM qamv

FOR ALL ENTRIES IN i_prueflos

WHERE prueflos = i_prueflos-prueflos AND

verwmerkm IN s_verw.

********************************************

SELECT abktxt bmblnr bmjahr bzeile bmatnr bbwart

dmaktx blifnr ename1 berfmg bdmbtr blfbnr

blfbja blfpos bsgtxt bsmbln bsjahr bsmblp

abudat bwerks

FROM mkpf as a

INNER JOIN mseg as b ON

amblnr = amblnr AND

bmjahr = bmjahr

INNER JOIN mara as c ON

bmatnr = cmatnr

INNER JOIN makt as d ON

cmatnr = dmatnr

INNER JOIN lfa1 as e ON

blifnr = elifnr

INTO CORRESPONDING FIELDS OF TABLE I_DATA

WHERE a~budat IN s_budat AND

a~mblnr IN s_mblnr AND

a~mjahr IN s_mjahr AND

b~werks IN s_werks AND

b~lifnr IN s_lifnr AND

b~bukrs IN s_bukrs AND

b~matnr IN s_matnr AND

b~bwart IN r_bwart AND

b~matnr IN s_matkl AND

d~spras = sy-langu AND

e~spras = sy-langu.

abhishek suppal

0 Kudos

Abhi,

Wow...you have some interesting queries there...

ok, one at a time...

first one:

select sum( afru~gmnga ) into v_gmnga

from afko

inner join afvc

on afkoaufpl = afvcaufpl

inner join afru

on afvcrueck = afrurueck and

afvcrmzhl = afrurmzhl

afko~aufnr = i_ord-aufnr and

afru~budat = p_date and

afru~ile02 = 'KWH' and

afru~stokz <> 'X' and

afru~stzhl = init_stzhl.

Give this a try. Since you know the Prod Order number, I thought it would be better to hit AFKO first as AUFNR is the Primary Key top this table. Now AFVC is the Prod Order Operation and AUFPL is the first field in it's Primary Key. Now AFVC has the Primary Key to AFRU. Now whether this actually 100% works or not is dependent on how your config is set up, but as I have tried to hit the primary keys whenever possible hopefully the performance should improve. You may want to open up a few sessions with SE16 and verify my joins as well...

Let me know how this goes...

Cheers,

Pat.

0 Kudos

Abhi,

The I would try and split the second statement upa bit.

Something like:

SELECT prueflos merknr vorglfnr masseinhsw verwmerkm

INTO CORRESPONDING FIELDS OF TABLE i_qamv

FROM qamv

FOR ALL ENTRIES IN i_prueflos

WHERE prueflos = i_prueflos-prueflos.

delete i_prueflos not verwmerkm IN s_verw.

I suggest this because PRUEFLOS is the first part of the key, and if you only provide this it will force the DB optimiser to use the primaty key.

Pat.

0 Kudos

Abhi,

OK, now this third statement is too big. I would recommend splitting it up a bit. Mainly because MKPF and MSEG are so big it scares me when we have to join them! There is no right or wrong way to hit these tables so you may have to play around a bit, but here are some thoughts:

First, let's assume that because you have a select option for MBLNR:

select mkpf~......

into table...

from mkpf

inner join mseg

on mkpfmblnr = msegmblnr and

mkpfmjahr = msegmjahr

where mkpf~mblnr in s_mblnr and

mpkp~mjahr in s_mjahr.

        • note, i did not use "into corresponding fields of table..." because "into table..." is more efficiient as "corresponding fields" checks each and every field name to make sure that they match, while "into table" simply assumes that the fields are in the same order in the table.

Now I would clear out I_DATA with a series of delete statements: ie.

delete i_data where not werks in s_werks.

etc...

Once again, let me know how you go.

Cheers,

Pat

0 Kudos

very thanx Pat,

i am trying these queries as told by u, then revert back to u as u know they can only give the results in the production sever only may be it takes times, but the information u gave is very helpful to me i think this will solve my problems.

abhishek suppal

0 Kudos

thanx pat

i am able to solve my first problem that is getting data from aufk tables.

abhishek suppal

0 Kudos

Hi Abhishek,

How did you solve your problem with the AUFK table? I'm always interested in finding new ways of doing things. Any progress on the other queries? Also if you have found any suggestions posted helpful, kindly reward points accordingly.

Cheers,

Pat.

0 Kudos

dear pat,

i m working on the other queries too. i will reward u all the points i don't have any problem in that...rest may be takes time but i can reward u til then....

abhishek suppal