Skip to Content
avatar image
Former Member

Index usage

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 14, 2008 at 06:15 AM

    Hi,

    Answer is option c & e.

    Regards,

    Amit

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 14, 2008 at 06:17 AM

    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...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 14, 2008 at 06:18 AM

    Hi,

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

    Regards,

    Renjith Michael.

    Add comment
    10|10000 characters needed characters exceeded