openedgeprogress-4gl

How do I know my query used index for the table I used?


I use a query below to check data in temp table. Also defined an index. I could sense that after adding the index to the temp table, the query gives the result asap. I would like to know how the index used by compiler. Is there a way to find out list of indexes used by compiler for the query I have used.

Note - I understand XREF gives WHOLE-INDEX for non-indexed tables. but I am not able to find out what are all the index used for indexed table.

DEFINE TEMP-TABLE TT_DATA NO-UNDO
FIELD TT_PART  AS CHARACTER
FIELD TT_DESC  AS CHARACTER
FIELD TT_IN    AS CHARACTER
FIELD TT_VEND  AS CHARACTER
FIELD TT_GLOB  AS CHARACTER
FIELD TT_TYPE  AS CHARACTER  
INDEX TT_IDX1 IS PRIMARY
TT_PART
TT_IN 
TT_VEND
.

FOR EACH <TABLE> NO-LOCK:
 FIND TT_DATA NO-LOCK
    WHERE TT_PART = "015564"
    AND   TT_IN = "VC"
    AND  TT_VEND = "SUPPLIER" NO-ERROR.
    
  IF AVAILABLE TT_DATA THEN
  DO:
   /*ACTUAL LOGIC GOES HERE*/ 
  END. /* IF AVAILABLE TT_DATA THEN*/
END. /*FOR EACH <TABLE> NO-LOCK:*/

Solution

  • If you are using XREF then look for the SEARCH lines (elements if XML). They tell you the index(es) used for that query.

    The same SEARCH lines will tell you if it's a WHOLE-INDEX query.