Previous Topic: Calculating the Size of an AreaNext Topic: Step 2: Determining the Page Size


Step 1: Calculating the Size of Each Cluster

Through clustering, users can store related entities close together in the database. Clustering allows a business application to access related entities quickly and efficiently. To ensure optimal processing, you need to base your database sizing calculations on the size of a cluster.

If you don't plan the use of storage resources effectively, the system may be unable to fit an entire cluster on a single page. Overflow conditions may occur, causing the system to perform two or more I/Os to access each application cluster. For a detailed discussion of overflow conditions, see "Overflow Conditions" earlier in this section.

Procedure

You can use the following procedures to calculate the size of a cluster:

  1. Identify the entity types in the cluster.
  2. Determine the length (in bytes) of each entity type stored in the cluster.
  3. If an entity participates in a relationship, add 4 bytes for each NEXT, PRIOR, OWNER, or INDEX pointer.

    Note: In an SQL implementation, linked clustered relationships always contain NEXT, PRIOR, and OWNER pointers. Linked indexed relationships always contain INDEX and OWNER pointers.

  4. If an entity in a non-SQL implementation is indexed, add 4 bytes for the INDEX pointer associated with each linked index.
  5. If an entity is stored CALC, add 8 bytes to allow for pointers in the CALC (SR1) chain.
  6. If an entity is variable length or compressed, add 8 bytes to allow for the variable-length indicator and fragment pointer.
  7. Add 8 bytes for each entity to allow for storage of line indexes.
  8. Sum the numbers calculated above to determine the total number of bytes for a single occurrence of each entity type.
  9. Determine the average number of occurrences of each entity type in a single cluster.
  10. Multiply the total bytes for each entity by the number of occurrences in the cluster to calculate the amount of space needed for each entity type in the cluster.
  11. Add the above space calculations to determine the total size for a single cluster.

Note: If any entity in the cluster is the parent of an indexed relationship, you need to allow space for storage of the internal index entities.

Sample cluster size calculation

The following diagram shows how the size of a cluster is determined.

In the EMP-DEMO-REGION area, 508 bytes will be required to store a complete cluster of EMPLOYEE, EXPERTISE, EMPOSITION, and STRUCTURE entities.

Note: If one or more indexes are to be included in the cluster, refer to the index size calculations later in this chapter.

The above calculations are for a non-SQL implementation. If this is an SQL implementation, note that the data length and index pointer options can differ.