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

regarding select query

Former Member
0 Likes
553

hi gurus,

iam using one select query with joins... but it fetches data from table that having lakhs of data... so the query is giving performance issue, so what select query i will write to solve this issue...

THE CODE IS IS GIVEN BELOW

SELECT ABLDAT ABUDAT ACPUDT BMATNR SUM( BMENGE ) BBWART

INTO TABLE ITAB FROM MKPF AS A

INNER JOIN

MSEG AS B

ON BMBLNR = AMBLNR AND BMJAHR = AMJAHR

WHERE A~BLDAT IN ZDATE AND

B~BWART IN ('131', '132') AND

B~LGORT = 'FG01' AND

BKZBEW = 'F' GROUP BY ABLDAT ABUDAT ACPUDT BMATNR BBWART.

LOOP AT ITAB.

CNT = CNT + 1.

ITAB2-CNT = CNT.

ITAB2-BLDAT = ITAB-BLDAT.

ITAB2-BUDAT = ITAB-BUDAT.

ITAB2-CPUDT = ITAB-CPUDT.

ITAB2-MATNR = ITAB-MATNR.

ITAB2-MENGE = ITAB-MENGE.

ITAB2-BWART = ITAB-BWART.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
524

Check you may use the view: WB2_V_MKPF_MSEG2. This may save you from joining two tables.

Use for all entries instead of join.

Try and compare the two select queries through a trace ST05.

I have seen the Select for all entries is far better in performance.

Edited by: jaya rangwani on Jul 31, 2009 1:33 PM

3 REPLIES 3
Read only

Former Member
0 Likes
525

Check you may use the view: WB2_V_MKPF_MSEG2. This may save you from joining two tables.

Use for all entries instead of join.

Try and compare the two select queries through a trace ST05.

I have seen the Select for all entries is far better in performance.

Edited by: jaya rangwani on Jul 31, 2009 1:33 PM

Read only

premal_mistry2
Active Participant
0 Likes
524

Hi Manish,

Use FOR ALL ENTRIES. It is much more efficient.

Regards,

Premal

Read only

Former Member
0 Likes
524

check for indexes in the table and if any index matches your where condition then use it in the same sequence.