cancel
Showing results for 
Search instead for 
Did you mean: 

problem related database access

Former Member
0 Kudos

hi experts,

i am using abap code which access a database table MCHB.

select matnr

werks

lgort

charg

clabs

ersda

into corresponding fields of table itab

from mchb

where matnr in pmatnr

and werks in mwerks

and lgort = plgort

  • and lgort = 'BSR'

and clabs > 0

AND ERSDA IN DATE1.

which contains more than 100000.

but for getting record from this we need more then 2 hr or more.

so please help me how to increase the performance of table.

thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

1. use fields in the where clause which are indexed. if you specify one field in the where condition which is not indexed (or part of an index) the database engine has to read the complete table.

2. reduce the number of data returned by the selection

peter

Former Member
0 Kudos

i am already using indexed field.

that are

charg.

lgort.

werks.

report reads database sequentialy that takes so much time.

fidel_vales
Employee
Employee
0 Kudos

Hello,

First, you should provide the SQL code that is taking long time, not the ABAP code:

<i>select matnr

werks

lgort

charg

clabs

ersda

into corresponding fields of table itab

from mchb

where matnr in pmatnr

and werks in mwerks

and lgort = plgort

  • and lgort = 'BSR'

and clabs > 0

AND ERSDA IN DATE1.</i>

That way we could SEE what variables have you specified ( is matnr specified?, HOW is it specified? is werks specified? HOW is it specified? is DATE1 specified?, HOW is it specified? )

Then you are told to use an index. you reply that you are using an index. And you mention that you are using one:

<i>i am already using indexed field.

that are

charg.

lgort.

werks.</i>

If I'm not wrong "CHARG", mentioned by you, is not specified on the query

Lgort it is specified by "=", good. But we do not know about werks.

First impresion is that the index is not good, but it is not possible to mention if it is due to

1) bad user imput

2) no existance of a better index ...

Note, in my system I do not have any index on CHARG, IGORT and WERKS