The CREATE INDEX statement

To create an Sybase IQ column index, use this syntax:

CREATE [ UNIQUE ] [ index-type ] INDEX index-name
... ON [ owner.]table-name
... ( column-name [, column-name]...)
... [ { IN | ON } dbspace-name ]
... [ NOTIFY integer ]
... [ DELIMITED BY separators-string‘ ]
... [ LIMIT maxwordsize-integer ]

If you do not specify an index-type, Sybase IQ creates an HG index. Several front-end tools create an HG index automatically for this reason.

Examples

The first example creates a High_Non_Group (HNG) index called ship_ix on the ship_date column of the sales_order_items table.

CREATE HNG INDEX ship_ix 
  ON dbo.sales_order_items (ship_date)

The second example creates a Low_Fast index called sales_order_region on the region column of the sales_order table.

CREATE LF INDEX sales_order_region 
  ON dbo.sales_order (region)

For examples of how to create a CMP index, see “The Compare (CMP) index type”.

By default, after every 100,000 records are inserted and loaded into indexes, you receive a progress message. To change the number of records, specify the NOTIFY option of CREATE INDEX. To prevent these messages, specify NOTIFY 0.

You can use the keywords BEGIN PARALLEL IQ and END PARALLEL IQ to delimit any number of CREATE INDEX statements that you want to execute as a group at the same time. These keywords can only be used when creating indexes on IQ tables, not temporary tables or Adaptive Server Anywhere tables. Note that, if one of these CREATE INDEX statements fails, all of them roll back. For more information, see the Sybase IQ Reference Manual.

NoteYou cannot place an index in a particular dbspace. Sybase IQ always places an index in the same type of dbspace (IQ Store or Temporary Store) as its table. When you load the index, the data is spread across any database files of that type with room available. The dbspace-name option of CREATE INDEX is ignored for IQ indexes, and is provided for compatibility with Adaptive Server Anywhere.