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: 
Read only

Index usage

0 Likes
617

Table ztest has a secondary index on the following fields:

tnum, tcode.

Select * from ztest where tnum ne '123' and tcode = '456'.

Why is the index not used in the above case?

a) Indexes are not allowed on Z tables

b) Variables must be used, NOT literals

c) Select individual fields, not select *

d) Client is not in the where clause

e) NE invalidates the use of an index

Can you help me? Is it option a)?

Thanks & Regards,

Lohit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
564

Hi,

Answer is option c & e.

Regards,

Amit

3 REPLIES 3
Read only

Former Member
0 Likes
565

Hi,

Answer is option c & e.

Regards,

Amit

Read only

madan_ullasa
Contributor
0 Likes
564

Hi,

There is nothing specific you need to do to use the indexed keys... Its more of an internal process for faster access of the values...Just see to that you use the keys in where condition in the same sequence as found in your table...

regds,

Madan...

Read only

Former Member
0 Likes
564

Hi,

You have to use all the fields used for indexing in where clause of the select query.

Regards,

Renjith Michael.