Quote:
Originally Posted by ProXtremer
Hello everybody,
I have to make a documentation about Index Structure and Hash Tables in DB2 but I can't find any information about Hash tabels, so any help will be welcome. Does DB2 support such a structure.. I read only about B-trees.
Thank you! Greetings
|
ORGANIZE BY KEY SEQUENCE
DB2 has a feature called ORGANIZE BY KEY SEQUENCE that I believe uses hashing, since each possible key value in the defined range has a predetermined location in the physical table (and the space must be allocated ahead of time when the table is created). A unique index is defined in the catalog using the ORGANIZE BY KEY SEQUENCE columns, but an actual index object is not created in storage, because the table organization is ordered by this key, so it uses a hash formula to find the location of the data in the table. Obviously, there can only be one Key Sequence per table (although it could contain more than one column). Very few people use this feature, and I don't know much about it.
Oracle has hash indexes, but I have never met an Oracle DBA who has used one. Nor have I met a DB2 who has used ORGANIZE BY KEY SEQUENCE. I think these are included so marketing people can tell prospective DBMS buyers that they have it, especially those who don't know much about DBMS's and purchase products based on how many features they contain.
DPF
In addition, DB2 uses hashing in Database Partitioning Feature (DPF) to determine which partition the row will be stored in. The partitioning key must be included as one or more columns of the Primary Key.