Application Development and Automation 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: 

1 of the field in existing secondary index

Former Member
0 Kudos
163

hi,

if in the existing secondary index, among the field in the index, for example field1, field2, field3, field4;

if field3 is the only field that i need to define in the where clause in my program, do i need to create a new secondary index?

thanks

4 REPLIES 4

Former Member
0 Kudos
119

Yes, it may make sense to still create another secondary index, even if you have a index with 3 fields and you want to add a 4 th field, because all other queries which depend on just those 3 fields will now become partial key queries.

This is more so, if you are trying to insert the 4th field in the middled instead of at the end. And of course the order of keys should be from more general at first to the most specific at the end.

Former Member
0 Kudos
119

If you want to put your fourth field at the end it will not cause performance problem in existing queries using that index, but it would definitely impact if you were to put the new field anywhere except at the end.

So go ahead if you want to insert a new field at the end of existing index, but then also make sure that it makes sense to insert the field at the end - what I mean is this new fields should be a finer and more specific attribute.

0 Kudos
119

hi all,

not add new field to the existing index.

what i meant was so happen that the existing index out of 4 fields, there is 1 field that only can map my requirement. so do i need to create a new index?

for example, existing index has field1, field2, field3, field4

whereas my where clause in my abap program is where field3 = .. only.

so do i need to create a new index with only field3?

or the existing index can fulfill my needs.

0 Kudos
119

Are you executing your select clause with WHERE clause on only field 3?

If so adding your field on an existing index with 3 fields already, will not solve your purpose, if it is performance that you are looking for. You need to create a new index, if you use the select clause with only field3, in any case

That said, if you would use all field1, field2, field3, field4 in your query and the index does have only field1, field2, field4 as of now, still you should not insert field3 in the middles as all other queries dependent on previous index will now become partial key queries.

So I would suggest you to go with a new index, if the SELECT query that you are talking about is performance critical.