How about using two fields of a primary index containing three fields?

This question is answered

I'd like to select from a table called "MMStdPickingOrderLine" by referencing on two fields (custAccount and pickingOrderId). This table has actual only one index which is primary and contains 3 fields. the fields I use in my statement and a third one. Will this Index work properly if I only use two of three fields or will I have to create a new index?

Thanks a lot.
René Pohlmeyer

 

Verified Answer
  • If you use only some fields from an index, the order of fields is important. You'll benefit from the index if your fields are on the beginning; otherwise you should consider changing the current index or creating a new one.

    It also depends on what DBMS you use (you could benefit from Oracle skip scans, for instance).

All Replies
  • If you use only some fields from an index, the order of fields is important. You'll benefit from the index if your fields are on the beginning; otherwise you should consider changing the current index or creating a new one.

    It also depends on what DBMS you use (you could benefit from Oracle skip scans, for instance).

  • Hello Martin,

    the used fields are on the beginning of the pri index.

    So, I don't have to create a new one.

    Thank you for quick reply.

    René Pohlmeyer