Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Index Performance Considerations >

Creating and Dropping an Index in an Online Environment

You can use the CREATE INDEX ONLINE and DROP INDEX ONLINE statements to create and drop an index in an online environment, when the database and its associated tables are continuously available.

The CREATE INDEX ONLINE statement enables you to create an index without having an exclusive lock placed over the table during the duration of the index build. You can use the CREATE INDEX ONLINE statement even when reads or updates are occurring on the table. This means index creation can begin immediately.

When you create an index online, the database server logs the operation with a flag, so data recovery and restore operations can recreate the index.

When you create an index online, you can use the ONLIDX_MAXMEM configuration parameter to limit the amount of memory that is allocated to the preimage log pool and to the updator log pool in shared memory. You might want to do this if you plan to complete other operations on a table column while executing the CREATE INDEX ONLINE statement on the column. For more information on this parameter, see Using the ONLIDX_MAXMEM Configuration Parameter Before Creating Indexes Online.

The DROP INDEX ONLINE statement enables you to drop indexes even when Dirty Read is the transaction isolation level.

The advantages of creating indexes using the CREATE INDEX ONLINE statement are:

The advantages of dropping indexes using the DROP INDEX ONLINE statement are:

If you initiate a DROP INDEX ONLINE statement for a table that is being updated, the operation does not occur until after the table update is completed. After you issue the DROP INDEX ONLINE statement, no one can reference the index, but concurrent operations can use the index until the operations terminate. The database server waits to drop the index until all users have finished accessing the index.

An example of a of creating an index in an online environment is:

CREATE INDEX idx_1 ON table1(col1) ONLINE

An example of dropping an index in an online environment is:

DROP INDEX idx_1 ONLINE

For more information on the CREATE INDEX ONLINE and DROP INDEX ONLINE statements, see the IBM Informix: Guide to SQL Syntax.

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