beautypg.com

Compaq COBOL AAQ2G1FTK User Manual

Page 514

background image

Optimizing Your Compaq COBOL Program
15.7 Optimizing File Design (OpenVMS)

Continue calculating index depth until you reach the root level—that is, when the
number of buckets needed to address the buckets from the previous level equals
1.

Level 2 (index buckets):

number of buckets =

217

66

= 4 level 2 buckets to address all level 1 buckets

Level 3 (index buckets):

number of buckets =

4

66

= 1 level 3 bucket to address all

level 2 buckets (Level 3 is the root bucket for the primary index:)

15.7.3.2 Calculating Key Index Levels

If you allow duplicate keys in alternate indexes, the number and size of SIDRs
depend on the number of duplicate key values in the file. (For duplicate key
alternate index calculations, see the OpenVMS Record Management Services
Reference Manual
.) Because alternate index records are usually inserted in
random order, the bucket packing efficiency ranges from about .5 to about .65.
The following example uses an average efficiency of .55.

In each of the following calculations, the results are either rounded up or
truncated.

Level 0 (data level buckets—no duplicate alternate keys):

SIDRs per bucket =

bytes per bucket 0 15

key size + 9

(result is truncated)

=

1536 0 15

8 + 9

= 89 SIDRs per bucket

number of buckets =

number of records

records per bucket

(result is rounded up)

=

100; 000

89

= 1124 level 0 alternate index buckets

Level 1 (index buckets):

records per bucket =

1536 0 15

8 + 3

= 138 index records per bucket :::

::: number of buckets =

1124

138

= 9 level 1 buckets to address data buckets (SIDRs)

at level 0

Level 2 (index buckets):

number of buckets =

9

138

= 1 level 2 bucket to address data buckets

at level 1 (level 2 is the root level)

15–24 Optimizing Your Compaq COBOL Program