Size Hash Indexes Appropriately
Performance impact: Variable
CREATE INDEX statement. The size of the hash
index is determined by the PAGES parameter specified in the
UNIQUE HASH ON clause of the CREATE TABLE and
CREATE INDEX statements.
The value for PAGES should be the expected number of rows in
the table divided by 256; for example, a 256,000 row table should have PAGES =
1000. A smaller value may result in a greater number of hash collisions,
decreasing performance, while a larger value may provide somewhat increased performance
at the cost of extra space used by the index.
If the number of rows in the table varies dramatically, and if performance is the primary consideration, it is best to create a large index. If the size of a table cannot be accurately predicted, consider using a range index. Also, consider the use of unique indexes when the indexed columns are large CHAR or binary values or when many columns are indexed. Unique indexes may be faster than hash indexes in these cases.
If the performance of record inserts degrades as the size of the table gets larger,
it is very likely that you have underestimated the expected size of the table. You can
resize the hash index by using the ALTER TABLE statement to reset the
PAGES value in the UNIQUE HASH ON clause. See
information about SET PAGES in the ALTER TABLE section in the Oracle TimesTen In-Memory Database SQL
Reference.