Home | Previous Page | Next Page   Managing Tables and Indexes > Planning and Managing Indexes >

Evaluating Index Costs

Although indexes are important for OLTP applications and can speed query execution, before you create an index consider the disk-space and update-time costs described in the following sections.

Disk-Space Costs

One cost of an index is disk space. An index can require large amounts of disk space. For some indexes, you might have as many index pages as table data pages. If you choose an attached index, consider the potential for extent interleaving, as described in Reducing Extent Interleaving.

For information about estimating index size, see Appendix A. Estimating Table and Index Size.

Update-Time and I/O Costs

For performance tuning, a more important cost of an index is the time and I/O required to update the index whenever the table is modified. If you index tables that are modified at specific times by batch load jobs, such as tables in databases used exclusively for DSS queries, the time cost of updating the index is incurred once, at load time. However, for OLTP applications that update tables continually, the time cost of updating an index might be significant.

The descriptions of update-time cost make the two following assumptions:

With these assumptions, conventional B-tree index maintenance adds different amounts of time for different kinds of table modifications, as the following list describes:

Insertions and deletions change the number of entries on a leaf page. Almost every action that changes the number of entries on an index page requires some additional work to deal with a leaf page that has either filled up or been emptied. However, if the number of such actions is greater than 100, this additional work occurs less than 1 percent of the time. You can often ignore this work when you estimate the I/O impact. For more information about index structure and maintenance costs, seeEstimating Conventional Index Page Size.

In short, when a row is inserted or deleted at random, three to four added page I/O operations occur for each 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 on an indexed table can take a long time.

Because the alteration of the table row itself requires only two page I/O operations, index maintenance can be the most time and I/O intensive part of data modification. For information about one way to reduce this cost, see Dropping Indexes.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]