Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Where clause

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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к

6 REPLIES 6

Former Member
0 Kudos

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

Former Member
0 Kudos

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к

former_member585060
Active Contributor
0 Kudos

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

0 Kudos

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

0 Kudos

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

Former Member
0 Kudos

Hi,

It will work fine, there is no need to create secondary index.