‎2006 Nov 20 3:50 PM
Experts,
Please have a look at the code below,following select statement is taking
long time to fecth the records, problem is i cannot chnage these select
statement to introduce key filelds because scenario is like that,how can i make
these select statement tuned to work fine
SELECT *
FROM ZBW_SCH_LINES
INTO CORRESPONDING FIELDS OF TABLE INT_OPEN_SCH_LINES_1
WHERE
( MBDAT GE D0 AND MBDAT LE D3 ) AND
( ( ZDATE GE D0 AND ZDATE LE D3 ) .
‎2006 Nov 20 3:53 PM
‎2006 Nov 20 3:59 PM
‎2006 Nov 20 3:54 PM
Looks like you don't need all the fields, but you still have *. See, if you can select the fields in the same order in which they appear in the fields INT_OPEN_SCH_LINES_1
AND TRY TO USE BETWEEN.
Try this
SELECT field1 field3 field4
FROM ZBW_SCH_LINES
INTO TABLE INT_OPEN_SCH_LINES_1
WHERE
( MBDAT BETWEEN D0 AND D3 ) AND
( ZDATE BETWEEB D0 AND D3 ) .
Regards,
Ravi
Note - Please mark all the helpful answers
‎2006 Nov 20 3:55 PM
It's a custom table. How is it updated - online or in batch. If in batch, you could create an index on mbdat and/or zdate.
The simplest thing to do would be to make sure that the interval between D0 and D3 is relatively small so that less data is returned.
Rob
‎2006 Nov 20 4:04 PM
hi
try creating a range or a select-options and then populate d0 and d3 there is mbdat the primary key field for the table. if not try to use the primary key aswel in where condition.
donot copy all the fields and donot use corresponding fields select by name in sequence
all these can reduce the time
u can even give a secondary index for the table
santhosh
‎2006 Nov 21 6:37 AM
To Improve the performance of SELECT statement you need to change select query in below areas
1. In the place of '' use Fieldlist (What are fileds you are using- the filedlist more than 1/3 better to use '').
2. Avoid INTO CORRESPONDING FIELDS clause (Define own internal table in program- it can avoid the corresponding clause)
3. As above rich told, Use secondary index for MBDAT,ZDATE for past DB Acess
Reagrds
Bhupal Reddy
‎2006 Nov 21 7:56 AM
1) Avoid using * in select instead of tht use field names in the same order they come in table.
2) dont use into corresponding fields instead of tht use into table (internal table )
I hope this hepls u .. if so plz reward points
Regards
Kali Pramod.