Index example: Join selection with a shared-weight sort sequence table

 

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

  SELECT * FROM STAFF S1, STAFF S2
   WHERE S1.JOB = S2.JOB

or the same query using the JOIN syntax.

  SELECT *
   FROM STAFF S1 INNER JOIN STAFF S2
         ON S1.JOB = S2.JOB

When using the OPNQRYF command, specify:

OPNQRYF FILE(STAFF STAFF) FORMAT(FORMAT1)
   JFLD((1/JOB 2/JOB *EQ))
   SRTSEQ(*LANGIDSHR) LANGID(ENU)

The system can only use index SHRIX for either query.

 

Parent topic:

Examples of indexes