Previous Topic: Define a DB2 LUW Tablespace

Next Topic: Define a DB2 LUW Table Trigger

Define DB2 LUW XML Indexes

You can create a table that has one or more columns of type XML. Query execution processes each XML instance at runtime, so a mechanism for indexing XML columns is provided to speed up queries. Use the DB2 for LUW XML Index Editor to define the XML columns participating in the table XML index.

To define a DB2 LUW XML Index

  1. Expand a Table in the Model Explorer.
  2. Right-click an XML Index and select Properties.

    The DB2 for LUW XML Index Editor opens.

  3. Select an XML index and work with the following options:

    Note: Click New New icon in property editors to create a new object on the toolbar to create an XML index. Use the Enter filter text text box to filter a large list of names to locate the one you want to work with.

    Name

    Specifies the name of the XML index.

    Schema

    Specifies a schema for the selected XML index.

    Column

    Specifies the column for which the XML index is being created. Select from the drop-down list. For the selected table, only those columns for which you have specified the Physical Data Type as XML appear in the drop-down list.

    Is Unique

    Specifies whether or not the selected XML index is unique.

    Generate

    Specifies whether or not to generate DDL for this object during Forward Engineering.

  4. Click the General tab and work with the following options:
    Invalid Value Action

    Specifies the action you want to take when DB2 encounters invalid XML patterns. Select from the drop-down list; valid values are Ignore and Reject.

    Tablespace

    Specifies the tablespace in which you want to create the index. Create or select from the drop-down list.

    Percent Free

    Specifies the percentage of each index page to leave as free space when building the index.

    Level 2 Percent Free

    Specifies the percentage of each index level 2 page to leave as free space when building the index.

    Minimum Percent Used

    Specifies whether index leaf pages are merged online, and the threshold for the minimum percentage of space used on an index leaf page.

    Allow Index Reverse Scan

    Specifies that an index can support both forward and reverse scans; that is, scanning of the index in the order that was defined at index creation time, and scanning in the opposite order.

    Page Split Type

    Specifies the index split behavior. Select from the drop-down list. The valid values are symmetric, high, and low.

    Collect Statistics Type

    Specifies that the index statistics have to be collected at the time of creating the index. Select from the drop-down list; valid values are Basic, Detailed, and Detailed by Sampling.

    Is Compressed

    Specifies that the index uses index compression. Select from the drop-down list; valid values are True and False.

  5. Click the XML Pattern tab and enter the pattern expression that identifies the nodes for indexing. In the SQL Data Type section, specify the data type to which you want to convert the indexed values before they are stored. Select from the drop-down list; valid values are Varchar, Double, Date, and Timestamp.
  6. Click the Permission tab and grant permissions to users, user groups, and/or roles on the selected XML index.
  7. Click the Comment tab and enter any comments you want to associate with the XML index.
  8. Click the Where Used tab to view where an XML index is used in the model.
  9. Click the UDP tab to work with user-defined properties for the XML index.
  10. Click the Notes tab to view history information and view or edit user notes.
  11. Click Close.

    The DB2 for LUW XML Index Editor closes.