2006 May 24 6:19 PM
Hi,
I have created a secondary index ZA2 for table LTAK with fileds LATER, PASSD and KQUIT.
In my Where clause:
Select * into <itab> from LTAK
where lgnum = plgnum AND
Kquit = 'X' and
passd = space
%HINTS MSSQLNT 'TABLE %TABLE% INDEX([LTAK~ZA2])'.
Is there anything wrong with Where clause, because i have not seen the better performence.
Thanks in advance.
narasimha
2006 May 24 6:24 PM
If you created the index on the following fields in this order,
LATER
PASSD
KQUIT
Then you should have LATER as the first field in your WHERE clause, otherwise your index is worthless.
Select * into <itab> from LTAK
<b>where later = 'whatever'
and Kquit = 'X'
and passd = space</b>
%HINTS MSSQLNT 'TABLE %TABLE% INDEX([LTAK~ZA2])'.
If you WHERE clause was like this, then you would see a performance boost.
Regards,
Rich Heilman
2006 May 24 6:31 PM
Hi Rich,
Thanks for your quick response. I forgot to mention LATER in the where clause.
my code:
Select * into <itab> from LTAK
where lgnum = plgnum AND
Kquit = 'X' and
LATER IN (1,2,3) and
passd = space
%HINTS MSSQLNT 'TABLE %TABLE% INDEX([LTAK~ZA2])'.
I there any problm if field sequnce is different.
Thanks.
2006 May 24 6:32 PM
You must include all the fileds exactly the index you created and you can verify in the SQL trace whether the index picked or not while selecting the data.
Thanks,
Vamshi
2006 May 24 6:34 PM
2006 May 24 6:58 PM
Is it required to add LGNUM filed into the secondary index?
Thanks,
Narasimha
2006 May 24 7:05 PM
2006 May 24 7:16 PM
Hi Rich,
There is no reason, actually the above select statement is a standard SAP statement in the function module L_TO_DN_READ. We are tying to improve the performence for the standard select statement.
Thanks,
Narasimha.
2006 May 24 7:39 PM
There already is an index on lgnum and kquit for table LTAK. I don't know how much performance would improve if you add another field.
But since it's a standard SAP program, open an OSS note and let SAP analyze it.
Rob