T.R | Title | User | Personal Name | Date | Lines |
---|
804.1 | | UKVMS3::PJACKSON | Oracle UK Rdb Support | Wed May 14 1997 07:41 | 14 |
| I did something like this on a DBMS database. I had a table with a
numeric key for which most accesses would be random, but sometimes
access in key order was needed. The records where small, so about 30
would fit on a 2 block page. I change the key into a group field with
two parts: the leading digits and the trailing one. I used only the
leading digits part for the hash key, so the records were stored in
groups of 9, 10 or 6 (the last two digits ranged from 01 to 25). This made
ordered access many times faster, and had no noticable effect on random
access.
Being able to modify the has algorithm would be useful for both ordered
and scattered hashed indexes.
Peter
|
804.2 | | NOVA::SMITHI | Don't understate or underestimate Rdb! | Wed May 14 1997 09:01 | 16 |
| I think what you really want is a KEY composed of two parts: the first part
is used to locate the page and the full key is used for retrieval.
A good use of this (not just for ORDERED HASH) is in the case of ORDER_HEADER
with clustered ORDER_LINES. The unique key for ORDER_HEADER is
(ORDER_NUMBER), but to get the clustering the ORDER_LINES need the same key
(ORDER_NUMBER) but it must allow DUPLICATES. To enforce a UNIQUE constraint
on (ORDER_NUMBER, LINE_NUMBER) requires an additional SORTED index.
If we could HASH on just ORDER_NUMBER but perform validation on the full key
(even if it just read through all the values in the HASH bucket) we could save
quite a bit of space and I/O.
(in short I like this idea :-)
Ian
|
804.3 | | svrav1.au.oracle.com::MBRADLEY | I was dropped on my head as a baby. What's your excuse? | Wed May 14 1997 21:34 | 17 |
| Ian,
I know you can use two fields, but this data will never have two fields as
the key.
It's just the simple case of a "sequence" type key, and we are not in a
position to redesign the application to make it a two part key (and in fact
I wouldn't like to make that sort of decision if I could avoid it... it
just complicates the application and the database).
Besides, there really isn't a natural group here like order headers and
lines, I just want to optimise storage and retrieval of adjacent key
values.
G'day,
Mark.
|
804.4 | | NOVA::SMITHI | Don't understate or underestimate Rdb! | Wed May 14 1997 22:13 | 8 |
| ~Besides, there really isn't a natural group here like order headers and
~lines, I just want to optimise storage and retrieval of adjacent key
~values.
Fine I wasn't suggesting you change anything, I was giving another example of
how this would be useful...
Ian
|