The CREATE INDEX statement

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

CREATEUNIQUE ] [ index-type ] INDEX index-name
... ONowner.]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 ShipIx on the ShipDate column of the SalesOrderItems table.

CREATE HNG INDEX ShipIx 
  ON dbo.SalesOrderItems (ShipDate)

The second example creates a Low_Fast (LF) index called SalesOrderRegionIX on the Region column of the SalesOrder table.

CREATE LF INDEX SalesOrderRegionIx 
  ON dbo.SalesOrder (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, or the option NOTIFY_MODULUS. 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 SQL Anywhere tables. If one of these CREATE INDEX statements fails, they all roll back. See Reference: Statements and Options.