An index provides quick access to data in a table, based on the values in specified columns.
An index is created on one or more table columns and points to the place where the
column data is stored on disk. Indexes speed data retrieval and are useful
for enforcing referential integrity. A table can have more than one
index.
- In the left pane of the Administration Console, expand , then choose one of the following:
- Click the Name field of the table, then click the drop-down arrow and select
Properties.
- In the left pane, click .
- Select .
- On the Name screen, enter a name for the index.
- On the Columns screen, select the columns to include in the index.
- (Optional) Click Add index column expression.
- Select Asc. or Desc. as the order of the index
expression.
- (Optional) Enter a name for the expression.
- On the Database Segment screen, select the database segment on which to place
the index.
- On the Database Cache screen, select a data cache for the index.
- (Optional) On the Key Type screen, select either or both of:
- Make this index unique – If the index is unique, you
can ignore duplicate keys in the Duplicate Keys/Row window.
- Make this index clustered – If the index is
clustered, specify how you want the server to handle requests to
insert duplicate rows in a table in the Duplicate Keys/Row
window.
- (Optional) On the Duplicate Key screen:
- Click Ignore duplicate keys to ignore duplicate keys rather than abort the transaction.
- Choose whether to allow or ignore duplicate rows in a table.
- (Optional) On the Space Management screen:
- Specify the percentage amount to fill a page when the index is created.
- Specify the number of rows allowed on pages.
- Specifying a ratio of empty pages to filled pages.
- (Optional) On the Index Compression screen, specify whether or not to apply
index compression.
- (Optional) On the Cache Strategy screen, specify the cache strategy when
creating the index:
- Most recently used replacement – reads new pages into
the LRU end of the chain of buffers in cache. The pages are used and immediately flushed when a new
page enters the MRU end.
This strategy is advantageous when a page is needed only once for a
query. It tends to keep such pages from flushing out other pages that
can potentially be reused while still in cache.
- Large buffer prefetch – if memory pools for large I/O
are configured for the cache used by a table or an index, the
optimizer can prefetch data or index pages by performing large
I/Os of up to eight data pages at a time. This prefetch strategy
can be used on the data pages of a table or on the leaf-level
pages of a nonclustered index. By default, prefetching is
enabled for all tables, indexes, and text or image objects.
Setting the prefetch option to off disables prefetch for the
specified object.
- Data already sorted – if data is already sorted, this
option saves index creation time.
- Online–
create indexes without blocking access to the data you are indexing.
Restrictions:
- User tables must include a unique index to use the
create clustered index ... online command
(creating nonclustered indexes does not have this
restriction).
- You can run create
index ... online with a pll sort only on round robin partitioned tables
- If you issue an insert,
delete, update, or
select command while create index … online or reorg … online are in the logical
synchronization blocking phase:
- The insert,
delete,
update, or select
commands may wait and execute after create index … online or
reorg … online
are finished
- SAP ASE may issue error message 8233.
- You cannot:
- Run dbcc commands and utility commands, such
as reog rebuild, on
the same table while you are simultaneously running
create index ...
online.
- Run more than one iteration of create index ... online
simultaneously.
- Perform a dump
transaction after running create index ... online.
Instead, you can:
- Run create index ... online, then dump the
database, or
- Run a blocking create index, then
issue dump
transaction.
- Run create
index ... online within a multistatement
transaction.
- Create a functional index using the
online parameter
- (Optional) On the Local Partition screen, specify whether to create a local
partitioned index.
- (Optional) Click Summary to review your selected
options.
- Click Finish to create the index.