‎2007 Oct 29 6:28 AM
Hi Gurus,
following query is taking a very long time
SELECT belnr gjahr buzei bukrs xstov augdt blart
INTO CORRESPONDING FIELDS OF TABLE it_bsis
FROM bsis
WHERE hkont IN glac
AND blart IN s_blart
AND budat IN dtfmto
AND shkzg IN p_shkzg.
There are 3408816 entries in bsis table. is there any possible way to make query with faster output.
Regards
Rajesh Kumar
‎2007 Oct 29 6:32 AM
Hi,
First: Don't use corresponding fields. Instead create a new internal table with the fields which you are selecting from BSIS.
Second: I believe there are no indexes being used here! You can check that in ST05 (SQL trace)
Regards
Nishant
‎2007 Oct 29 6:50 AM
Hi Nihant,
I have changed my query to as below.
SELECT belnr gjahr buzei bukrs xstov augdt blart
INTO TABLE it_bsis
FROM bsis
WHERE hkont IN glac
AND blart IN s_blart
AND budat IN dtfmto
AND shkzg IN p_shkzg.
It still taking very long time.
How can i use ST05 to trac sql.
Regards
Rajesh Kumar
‎2007 Oct 29 7:01 AM
> Hi Nihant,
> I have changed my query to as below.
>
> SELECT belnr gjahr buzei bukrs xstov augdt blart
> INTO TABLE it_bsis
> FROM bsis
> WHERE hkont IN glac
> AND blart IN s_blart
> AND budat IN dtfmto
> AND shkzg IN p_shkzg.
> ill taking very long time.
>
> How can i use ST05 to trac sql.
>
> Regards
>
> Rajesh Kumar
I know b'coz the other problem is that there is no usage of index!
what you can do is open ST05 in another session.
Then do start trace.
Then execute your program
Then do deactivate trace
Then display
Find BSIS.
Then select that line and press 'EXPLAIN'
This will show which INdex was used by this query.
In case no index is used then you can just look at indexes already present in system for this table and try to use those.
Regards
Nishant
‎2007 Oct 29 7:03 AM
Hi Rajesh,
Select query where clause condition is in wrong order change it as like below it will surely improve the performance
SELECT belnr gjahr buzei bukrs xstov augdt blart
INTO TABLE it_bsis
FROM bsis
WHERE hkont IN glac
AND budat IN dtfmto
AND blart IN s_blart
AND shkzg IN p_shkzg.
Reward the points if its useful
Regards
Manikumar