Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   Index Performance Considerations > Managing Indexes >

Time Costs of Indexes

The second cost of an index is time whenever the table is modified. The following descriptions assume that approximately two pages must be read to locate an index entry. That is the case when the index consists of a root page, one level of branch pages, and a set of leaf pages. The root page is assumed to be in a buffer already. The index for a very large table has at least two intermediate levels, so about three pages are read when the database server references such an index.

Presumably, one index is used to locate a row being altered. The pages for that index might be found in page buffers in shared memory for the database server. However, the pages for any other indexes that need altering must be read from disk.

Under these assumptions, index maintenance adds time to different kinds of modifications, as the following list shows:

Insertions and deletions change the number of entries on a leaf page. Although virtually every pagents operation requires some additional work to deal with a leaf page that has either filled or been emptied, if pagents is greater than 100, this additional work occurs less than 1 percent of the time. You can often disregard it when you estimate the I/O impact.

In short, when a row is inserted or deleted at random, allow three to four added page I/O operations per index. When a row is updated, allow six to eight page I/O operations for each index that applies to an altered column. If a transaction is rolled back, all this work must be undone. For this reason, rolling back a transaction can take a long time.

Because the alteration of the row itself requires only two page I/O operations, index maintenance is clearly the most time-consuming part of data modification. For information about one way to reduce this cost, see Clustering .

Removing Unclaimed Index Space

A background thread, the B-tree scanner, identifies an index with the most unclaimed index space. Unclaimed index space degrades performance and causes extra work on the server. When an index is chosen for scanning its entire leaf is scanned for deleted (dirty) items that were committed but not yet removed from the index. B-tree scanner removes these items when necessary. B-tree scanner allows multiple threads and can be invoked on the command line by the administrator. For details, see the Administrator's Reference.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]