tags:

views:

57

answers:

1

When inserting a large number of rows into a single table hash cluster in Oracle, it will fill up the block with any values that hash to that hash-value and then start using overflow blocks.

These overflow blocks are listed as chained off the main block, but I can not find detailed information on the way in which they are allocated or chained.

When an overflow block is allocated for a hash value, is that block exclusively allocated to that hash value, or are the overflow blocks used as a pool and different hash values can then start using the same overflow block.

How is the free space of the chain monitored - in that, as data is continued to be inserted, does it have to traverse the entire chain to find out if it has some free space in the current overflow chain, and then if it finds none, it then chooses to allocate a new block?

+1  A: 

From the Concepts Guide (scroll down to "Hash Cluster Storage":

When users insert rows into the cluster for department 43, the database cannot store these rows in block 100, which is full. The database links block 100 to a new overflow block, say block 200, and stores the inserted rows in the new block. Both block 100 and 200 are now eligible to store data for either department. As shown in Figure 2-7, a query of either department 20 or 43 now requires two I/Os to retrieve the data: block 100 and its associated block 200.

This means that the overflow block is exclusively allocated to that hash value.

I don't know the answer to your second question though.

Tony Andrews
I've seen the diagram although it doesn't explicitly state it is exclusive, the inference is that it is.
Andrew
Yes, I agree the relationship is implicit rather than explicit, but this part is fairly clear: "The database links block 100 to a new overflow block, say block 200". It doesn't say "The database links block 100 to a new overflow block, say block 200, or to an existing overflow block". The implication is that the overflow block "belongs to" the original block, and the original block as we know belongs to the hash value.
Tony Andrews
+1 so far, just need the second part which is the more important aspect of it performance wise.
Andrew
Logically, it makes sense that Oracle would allocate a free block to the end of the chain. I don't know whether the chains of blocks would be singly- or dual-linked. I'd suspect dual-linkage as that's an existing mechanism in place for index leaf blocks. From an I/O perspective, I don't know why it's really relevant; you're going to have to search every block in the hash chain, and none of those overflow blocks are guaranteed to be contiguous after the initial allocation.
Adam Musch
It's relevant to insertion performance, since it will get slower and slower the more overflow blocks allocated per hash-value. One they are in, then the I/O for that hash-value will be consistant and I agree have to read every block.
Andrew