Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Optimizer Directives > Using External Optimizer Directives >

Creating and Saving External Directives

To create and save external directives
  1. Create the association records to use for the query directives.

    Association records are rows that an Administrator can insert into SQL statements when needed. The following example shows an association-record row that can be used as a query directive.

    save external directives {+INDEX(t1,i11)} active for
    select {+INDEX(t1, i2) } c1 from t1 where c1=1;

    id             16
    query          select {+INDEX(t1, i2) } c1 from t1 where c1=1
    directive      INDEX(t1,i11)
    directivecode  BYTE value

    active         1
    hashcode       -589336273
  2. Save the directives in the sysdirectives catalog, using the SAVE EXTERNAL DIRECTIVES statement as shown in the following example:
    SAVE EXTERNAL DIRECTIVES directives [ACTIVE/INACTIVE/TEST ONLY]
    FOR Select/* INDEX( table1 , index1 )*/ col1 , col2
    From table1, table 2
    Where table1.col1+table2.col1

    The information in directives must be in the same format within comments exactly as the directive would appear in SELECT, UPDATE, and DELETE statements. (See the IBM Informix: Guide to SQL Syntax for more information on SAVE EXTERNAL DIRECTIVES).

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]