DB2 9 for z/OS offers relief in this area by allowing the insert of the sequential column through a new RANDOM option on both the CREATE INDEX and ALTER INDEX statements. When RANDOM is used on the column in an index, DB2 stores the key values in random locations within the index tree. This reduces the chance of ever-increasing sequential inserts being on the same page, which decreases the chance of having lock contention.
Randomly ordered indexes can be used with equality lookups on a specific column. In addition, randomly ordered key columns can be used in non-matching index scans, while index-only access can be used in random key columns.
Here's an example of a CREATE INDEX using the RANDOM clause:
CREATE INDEX creator.table_name_idx1
ON creator.table_name
(COL1 ASC
,COL2 RANDOM)
RANDOM cannot be specified on a key column that is varying in length with the NOT PADDED option. If you've taken advantage of RANDOM key columns in your application, please take a moment and tell us of your experience in Comments.




My friend Dan Luksetich pointed out to me that he has had some high transaction inserts 13,000 per second in a two way data sharing without a problem. I also noticed Willie's blog on this topic: http://it.toolbox.com/blogs/db2zos/db2-9-random-index-sounds-very-32659
So unless you are experiencing real pain with insert contention you may want to take more time testing this option out before you jump in and use it.
If you have used this feature to solve a real pain please post a note and let us know what you experienced.
Posted by: Troy Coleman | November 11, 2009 at 07:46 PM