Contents Index Using clustered indexes Validating indexes

ASA SQL User's Guide
  Working with Database Objects
    Working with indexes

Creating indexes


Indexes are created on one or more columns of a specified table. You can create indexes on base tables or temporary tables, but you cannot create an index on a view. To create an individual index, you can use either Sybase Central or Interactive SQL. You can use the Index Consultant to guide you in a proper selection of indexes for your database.

To create a new index for a given table (Sybase Central)

  1. Open the Indexes folder.

  2. From the File menu, choose New > Index.

    The Index Creation wizard appears.

  3. Name the index and select the table from the list. Click Next.

  4. Follow the instructions in the wizard.

    New indexes appear in the Indexes folder.

To create a new index for a given table (SQL)

  1. Connect to a database with DBA authority or as the owner of the table on which the index is created.

  2. Execute a CREATE INDEX statement.

In addition to creating indexes on one or more columns in a table, you can create indexes on a built-in function using a computed column. For more information, see CREATE INDEX statement.

Example 

To speed up a search on employee surnames in the sample database, you could create an index called EmpNames with the following statement:

CREATE INDEX EmpNames
ON employee (emp_lname, emp_fname)

For more information, see CREATE INDEX statement, and Monitoring and Improving Performance.


Contents Index Using clustered indexes Validating indexes