Download C-ISAM Programmer`s Manual

Transcript
Performance Considerations
Trailing Space Compression
This compression technique removes trailing blanks from each key. The number of characters compressed is stored in one byte at the beginning of the key.
Figure 2-16 shows an example of this compression technique combined with
leading character compression (k_flags= TCOMPRESS + LCOMPRESS). The
one-byte overhead required to record the number of trailing spaces is shown
as a pound sign ( # ). This byte is in addition to the byte required in the key
entry to hold the number of leading characters that are compressed. The dots
( . ) represent spaces. If this illustration is representative of the entire index,
the compression results in a 67.5 percent savings.
Key
Value
Compressed with
LCOMPRESS +
TCOMPRESS
Abbot...............
Able................
Acre................
Albert..............
Albertson...........
Morgan..............
McBride.............
McCloud.............
Richards............
Richardson..........
##Abbot
##le
##cre
##lbert
##son
##Morgan
##cBride
##Cloud
##Richards
##on
200 bytes
65 bytes
Bytes
Saved
13
16
15
13
15
12
12
13
10
16
-----135 bytes
Savings = 67.5 %
Figure 2-16
Leading Character and Trailing Blank Compression
Duplicate Key and Maximum Compression
Duplicate compression (DCOMPRESS) removes duplicate keys from the
index. A two-byte duplicate flag replaces the key.
COMPRESS is a shorthand way of specifying maximum compression using
duplicate key compression, leading character compression, and trailing
blank compression.
Figure 2-17 shows an example using COMPRESS. Two overhead bytes are
associated with each non-duplicate key: one to hold the number of leading
characters that are compressed and the other to hold the number of trailing
blanks that are compressed. This overhead is represented by two pound signs
2-26
Indexing