INDEXES

Prerequisites

You have generated the demo data for the SQL Tutorial.

Log on to the demo database instance DEMODB as user MONA.

Create indexes. Proceed as described in SQL Tutorial, Indexes.

Examples

You can use the system table INDEXES to determine the following database information, among other things:

?     All indexes for the table CUSTOMER and information on which indexes are not currently being used for search operations (so have status DISABLED)

SELECT indexname, disabled
  FROM DOMAIN.INDEXES
    WHERE tablename = 'CUSTOMER'

?     All UNIQUE indexes (regardless of which of the possible SQL statements was used to create them: CREATE INDEX Statement or UNIQUE Definition)

SELECT schemaname, tablename, indexname
  FROM DOMAIN.INDEXES
    WHERE type = 'UNIQUE'

Columns of an index: see INDEXCOLUMNS