Table C (File architecture): Difference between revisions
No edit summary |
No edit summary |
||
(16 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
<p>Table C is a hashed table divided into entries of seven bytes each. Table C | <p>Table C is a hashed table divided into entries of seven bytes each. Table C | ||
entries store index information for fields that have the KEY or the NUMERIC | entries store index information for fields that have the <var>KEY</var> or the <var>NUMERIC | ||
RANGE | RANGE</var> attribute.</p> | ||
<p>This page discusses the architecture underlying Table C. For information on monitoring, tuning and performance issues, refer to [[Tuning the | <p>This page discusses the architecture underlying Table C. For information on monitoring, tuning, and performance issues, refer to [[Tuning the hash index]].</p> | ||
== Overview == | ==Overview== | ||
<p> Model 204 creates a chain of entries in Table C for each value stored in a KEY field and several chains of entries for each value stored in a NUMERIC RANGE field.</p> | <p> | ||
Model 204 creates a chain of entries in Table C for each value stored in a <var>KEY</var> field, and several chains of entries for each value stored in a <var>NUMERIC RANGE</var> field.</p> | |||
<p> Any time a field (whether preallocated or a [[Field | <p> Any time a field (whether preallocated or a [[Field value pairs (File architecture)|field value pair]]) that has the <var>KEY</var> or <var>NUMERIC RANGE</var> attribute is added to a record, the hashing algorithm is used to find a Property entry. If it is not found it is created.</p> | ||
<p>New KEY values require only two slots in Table C for an initial creation (one Property and one Segment entry). If the file size multiplier (discussed in | <p>New <var>KEY</var> values require only two slots in Table C for an initial creation (one Property and one Segment entry). If the file size multiplier (discussed in [[File size calculation in detail#Computing the file size multiplier (N)|Computing the file size multiplier (N)]]) is greater than 1 (signifying the number of segments in the file), <var>KEY</var> values might require more than two slots. Therefore, at a rate dependent upon the level and nature of update activity, the number of slots used increases.</p> | ||
greater than 1, KEY values might require more than two slots. Therefore, at a | |||
rate dependent upon the level and nature of update activity, the number of slots | |||
used increases.</p> | |||
<p>The chain is read (or created) to find the Segment entry covering the record being updated.</p> | |||
<p> | <p>Because of the hashed nature of the contents, Table C may not be increased dynamically. Any changes must be done via a [[File reorganization and table compaction|reorganization]].</p> | ||
<p> | ==Table C page structure== | ||
<p> | |||
Every Table C page is composed of a series of 7-byte hash cells (a total of 877 per page). It also contains 5 bytes used to track "spills" (cases where the entry cannot be placed on the page to which the field/value hashes).</p> | |||
<p>The hash cells contain one of two types of entry: property and segment.</p> | |||
<p> | ==Property entries== | ||
<p> | |||
A property entry is the starting point of a chain. When reading or updating a hash index, this is the location to which the field/value hashes in. From there, the chain of segment entries are read.</p> | |||
<p> | ==Segment entries== | ||
<p> | |||
Chained from the property entry are one or more segment entries (see the definition of segment, which follows).</p> | |||
<p>Segment entries have two possible references to records:</p> | |||
<ul> | |||
<li>If the segment contains one and only one record with that combination of field and value, there is a direct pointer to the record (the [[Table B (File architecture)#Internal Record Number|Internal Record Number (IRN)]] is physically stored in the Table C entry). | |||
<li>Otherwise, the segment points to a [[Table D (File architecture)#List and bitmap pages|list or bitmap page]]. | |||
</ul> | |||
It is quite possible that, for a particular field/value, some of the segment pointers directly point to records; others point to list or bitmap pages; and some segments, where no records have the value for this field, have no occurrence in the chain at all. | |||
===Segment definition=== | |||
<p> | |||
A segment is a set of 49152 base record slots. This "magic" number comes from the number of bits that fit on a Model 204 page (see [[Table D (File architecture)#List and bitmap pages|List and bitmap pages]]).</p> | |||
[[Category:File architecture]] | [[Category:File architecture]] |
Latest revision as of 22:29, 13 April 2015
Table C is a hashed table divided into entries of seven bytes each. Table C entries store index information for fields that have the KEY or the NUMERIC RANGE attribute.
This page discusses the architecture underlying Table C. For information on monitoring, tuning, and performance issues, refer to Tuning the hash index.
Overview
Model 204 creates a chain of entries in Table C for each value stored in a KEY field, and several chains of entries for each value stored in a NUMERIC RANGE field.
Any time a field (whether preallocated or a field value pair) that has the KEY or NUMERIC RANGE attribute is added to a record, the hashing algorithm is used to find a Property entry. If it is not found it is created.
New KEY values require only two slots in Table C for an initial creation (one Property and one Segment entry). If the file size multiplier (discussed in Computing the file size multiplier (N)) is greater than 1 (signifying the number of segments in the file), KEY values might require more than two slots. Therefore, at a rate dependent upon the level and nature of update activity, the number of slots used increases.
The chain is read (or created) to find the Segment entry covering the record being updated.
Because of the hashed nature of the contents, Table C may not be increased dynamically. Any changes must be done via a reorganization.
Table C page structure
Every Table C page is composed of a series of 7-byte hash cells (a total of 877 per page). It also contains 5 bytes used to track "spills" (cases where the entry cannot be placed on the page to which the field/value hashes).
The hash cells contain one of two types of entry: property and segment.
Property entries
A property entry is the starting point of a chain. When reading or updating a hash index, this is the location to which the field/value hashes in. From there, the chain of segment entries are read.
Segment entries
Chained from the property entry are one or more segment entries (see the definition of segment, which follows).
Segment entries have two possible references to records:
- If the segment contains one and only one record with that combination of field and value, there is a direct pointer to the record (the Internal Record Number (IRN) is physically stored in the Table C entry).
- Otherwise, the segment points to a list or bitmap page.
It is quite possible that, for a particular field/value, some of the segment pointers directly point to records; others point to list or bitmap pages; and some segments, where no records have the value for this field, have no occurrence in the chain at all.
Segment definition
A segment is a set of 49152 base record slots. This "magic" number comes from the number of bits that fit on a Model 204 page (see List and bitmap pages).