Creating indexes, Indexes in the system tables – Sybase 12.4.2 User Manual

Page 153

Advertising
background image

CHAPTER 3 Working with Database Objects

133

Indexes are created on a specified table, or on a set of tables for join indexes.
You cannot create an index on a view.

Creating indexes

You can create column indexes in three ways:

With the

CREATE INDEX

command

With the Add Index option in Sybase Central

With the

UNIQUE

or

PRIMARY KEY

column constraint of

CREATE TABLE

,

which creates a unique index automatically.

You can create a join index in two ways:

With the

CREATE JOIN INDEX

statement

With the Join Index Editor in Sybase Central

See Chapter 4, “Adaptive Server IQ Indexes” for details on selecting and
creating indexes. See the Adaptive Server IQ Reference Manual for command
syntax.

Indexes in the system tables

Information on indexes is in the system tables

SYSINDEX

,

SYSIQINDEX

,

SYSIXCOL

, and for join indexes,

SYSIQJINDEX

. See the Adaptive Server IQ

Reference Manual for a description of these tables. See Introduction to
Adaptive Server IQ
for an explanation of how to browse system tables in
DBISQL and in Sybase Central.

Displaying indexes
using stored
procedures

You can also use the stored procedure

sp_iqindex

to display a list of indexes and

information about them. For example, to list the indexes in the sales_order
table, issue the command:

sp_iqindex ’sales_order’

The following information displays. (A remarks column also appears, but is not
shown here.)

Advertising