Index example: Grouping with a shared-weight sort sequence table

 

Grouping with a shared-weight sort sequence table (SRTSEQ(*LANGIDSHR) LANGID(ENU)).

  SELECT JOB FROM STAFF    GROUP BY JOB

When using the OPNQRYF command, specify:

OPNQRYF FILE((STAFF)) FORMAT(FORMAT2)
   GRPFLD((JOB)) 
   SRTSEQ(*LANGIDSHR) LANGID(ENU)

The system can only use index SHRIX.

The following examples assume that 3 more indexes are created over columns JOB and SALARY. The CREATE INDEX statements precede the examples.

Assume an index HEXIX2 was created with *HEX as the sort sequence.

   CREATE INDEX HEXIX2 ON STAFF (JOB, SALARY)
Assume that an index UNQIX2 was created and the sort sequence is a unique-weight sort sequence.
   CREATE INDEX UNQIX2 ON STAFF (JOB, SALARY)

Assume an index SHRIX2 was created with a shared-weight sort sequence.

   CREATE INDEX SHRIX2 ON STAFF (JOB, SALARY)

 

Parent topic:

Examples of indexes