cancel
Showing results for 
Search instead for 
Did you mean: 

Select statement with all keys in where condition

t_ravichandra
Explorer
0 Kudos

Hi Team,

I have a req to read the data from one table(tab1) and it has 2 IO as a keyfields. PFB screenshot.t_ravichandra_0-1709122595619.png

In the above tables, we have 5200 entries with one unique value on key field1 and 5200 distinct values. 

I have a requirement to select data from the above table, but in the where condition i am able to pass only one value and since other key field has distinct values, not sure how to give these values in the where condition. 

t_ravichandra_1-1709122983429.png

My concern is since the select statement where condition has only one key field and table has 2 keyfields, hence the select statement will not hit table based on primary index, instead it will do linear search. 

So my question is, do we have any option to pass keyfield2 which has to read all the data, so that it will hit the primary index in the select statement. 

Note : I don't have option to create secondary index. 

 

 

 

Sandra_Rossi
Active Contributor
0 Kudos
I don't understand very well, what the table contains, etc. It's not clear if your SELECT is about the first key field or the second one... Possibly you are doing a SELECT with the first key field, in that case it's fine, you have nothing to change. If you mean you are doing an access with the second key field only hence it will do a full scan. So, the answer is to create an index on the second key field. You have no other choice.

Accepted Solutions (0)

Answers (0)