Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3167

select join statement bad performance

$
0
0

Hi all,

 

I have a select statement below;

 

select * into table itab from ekpo as a

            inner join ekbe as b

            on a~ebeln = b~ebeln and a~ebelp = b~ebelp

            inner join rbkp as c

            on b~belnr = c~belnr and b~gjahr = c~gjahr

     where ( a~matnr = 'XXXXX' or a~zzmatnr = 'XXXXX' )

         and b~belnr  like '510%'.

 

This statement is very slow because of ( a~matnr = 'XXXXX' or a~zzmatnr = 'XXXXX' ) part of where statement.

When I change where statement

 

    where   a~matnr = 'XXXXX'

         and b~belnr  like '510%'.

 

like this, it is so fast. But I must select the union of lines from ekpo where matnr =  'XXXXX' also zzmatnr(custom field in ekpo) = 'XXXXX'.

I created a secondary index to ekpo for zzmatnr field but nothing changed. Again so bad performance.



Do you have any idea about this?

 

Thanks.

Gözde Candan Soysal


Viewing all articles
Browse latest Browse all 3167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>