Example documentationINDEXES Locate this document in the navigation structure

 

Use of the system table DOMAIN.INDEXES

Prerequisites

You can use the demo data for the SQL tutorial. Start the Database Studio as database administrator MONA with the password RED and log on to demo database DEMODB: Logging On to a Database.

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

Activities

You can use Database Studio to enter and execute SQL statements. More information: Working with SQL Statements: Overview

Note the General Instructions for formulating SQL statements.

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'

More Information

Columns in an index: see INDEXCOLUMNS