Oracle 8i Data Cartridge Developer's Guide Release 2 (8.1.6) Part Number A76937-01 |
|
Power Demand Cartridge Example , 3 of 8
Before you use extensible indexing, you should first ask whether the users of the table will benefit from having the domain index. That is, will they execute queries that could run just as efficiently using a standard Oracle index, or using no index at all.
A query does not require a domain index if both of the following are true:
equals
, lessthan
, greaterthan
, max
, and min
for a b-tree index.
In the PowerDemand_Typ
object type cartridge example, the values for three columns (TotGridDemand
, MaxCellDemand
, and MinCellDemand
) are set by functions, after which the values do not change. (For example, the total grid power demand for 13:00 on 01-Jan-1998 does not change after it has been computed.) For queries that use these columns, a standard b-tree index on each column is sufficient and recommended for operations like equals
, lessthan
, greaterthan
, max
, and min
.
Examples of queries that would not benefit from extensible indexing (using the power demand cartridge) include:
To make this query run efficiently, define two additional columns in the PowerDemand_Typ
object type (AverageCellDemand
and MedianCellDemand
), and create functions to set the values of these columns. (For example, AverageCellDemand
is TotGridDemand
divided by 100.) Then, create b-tree indexes on the AverageCellDemand
and MedianCellDemand
columns.
A query benefits from a domain index if the data being queried against cannot be made a simple attribute of a table or if the operation to be performed on the data is not one of the standard operations supported by Oracle indexes.
Examples of queries that would benefit from extensible indexing (using the power demand cartridge) include:
By asking for the first cell, the query goes beyond a simple true-false check (such as finding out whether any cell for a specified time had a demand equal to a specified value), and thus benefits from a domain index.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|