01-17-2009 11:36 AM
can we use non-primary key field in where clause to select data??...
does the selection causes bad performance??..
i couldnt find in abap documentation whether we can use it or not..
Thanks,
Sri
01-17-2009 12:59 PM
Its not suggested to use no key fields as the only criteria in where clause, no inclusion of key fields does affect the performance, u may not experiance tht performance delay that much in ur dev or test system and may be tempted to ignore the performance issue for ease in coding but when ur program goes to production where some thousands and lacs of records exist, ur query may run for hours.
So try as much as possible to include all key fields.
кu03B1ятu03B9к
01-17-2009 12:29 PM
can we use non-primary key field in where clause to select data??..
I suggest you try for yourself first and see, you will get your answer.
regards,
Advait
01-17-2009 12:59 PM
Its not suggested to use no key fields as the only criteria in where clause, no inclusion of key fields does affect the performance, u may not experiance tht performance delay that much in ur dev or test system and may be tempted to ignore the performance issue for ease in coding but when ur program goes to production where some thousands and lacs of records exist, ur query may run for hours.
So try as much as possible to include all key fields.
кu03B1ятu03B9к
01-17-2009 2:32 PM
If possible create Secondary Index and use date fields in where clause
Check out this blog
/people/rob.burbank/blog/2006/09/13/using-an-index-when-you-dont-have-all-of-the-fields
Edited by: Bala Krishna on Jan 17, 2009 8:03 PM
01-18-2009 5:21 AM
I need to fetch the customer details based on a particular organization>channel>division.
SELECT A~KUNNR
B~LAND1
B~NAME1
INTO TABLE T_KNA1
FROM KNVV AS A INNER JOIN KNA1 AS B
ON AKUNNR = BKUNNR
where A~VKORG = L_VKORG AND
A~VTWEG = L_VTWEG AND
A~SPART = L_SPART.
shall i create a secondary index for all the three fields vkorg,vtweg and spart??..
Or is the query i wrote works well??......
Thanks
Sri
01-19-2009 2:53 PM
Bala - I appreciate your mentioning my blog, but I would almost never recommend creating a secondary index on a SAP standard table to speed up a single SELECT in a single user program.
Rob
01-19-2009 7:07 AM
Hi,
It will work fine, there is no need to create secondary index.