Previous Topic: Step 2: Determining the Page SizeNext Topic: Allocating Space for Indexes


Step 3: Calculating the Number of Pages in the Area

After you have identified the optimal page size for a database area, you can determine the number of pages that should be allocated to that area. If significant growth is expected early, plan for 50 percent initial capacity and allow for growth up to 70 to 80 percent. As a general rule, you should try to avoid exceeding 70 percent capacity.

Procedure

To calculate the total number of pages required for a database area, perform the following procedures:

  1. Calculate the number of bytes in each entity in the area: multiply the number of bytes in each entity by the number of occurrences. Below is a form you can use to compute the number of bytes required for each entity type. After you have determined how much space is needed for each entity type, add the bytes for each entity to determine the total number of bytes for the area.
  2. Calculate the number of base pages by dividing the total entity bytes by the page size minus 32.
  3. Divide the result by the desired space utilization (70 percent) to get the total number of base pages. (Static files average 70 percent; dynamic files average 50 percent.) If there are any SR8 entities in the area, you may want to increase the page reserve.
  4. Subtract 32 from the page size and divide by 2 (bytes per SMP entry). Divide the quotient into the number of base pages and round up to the next integer. The result is the number of space management pages.

    Note: For large databases, the CALC algorithm operates most effectively when the number of pages in the area is a prime number.

  5. Add the number of base pages and space management pages to determine the total number of pages in the area.
  6. To calculate the number of tracks needed, divide the number of pages in the area by the number of pages per track on the type of disk device being used.

Sample area size calculation

The following form shows how the number of pages in an area is determined.

The EMP-DEMO-REGION area needs 508,000 bytes to store all occurrences of the EMPLOYEE, EXPERTISE, EMPOSITION, and STRUCTURE entities. Calculations determine that 173 database pages of 4276 bytes need to be allocated to accommodate these entities.

  1. Entity bytes per area = 508 k bytes.
  2. Calculate the number of base pages by dividing the total bytes by page size minus 32:
    4276 - 32 = 4244
    508,000 / 4244 = 120 pages (rounded up)
    
  3. Divide by desired space utilization (70%): 172 (rounded up).
  4. Subtract 32 from page size and divide by two. Divide the quotient into the number of base pages and round up to the next integer. The result is the number of space management pages:
    172 / 2122 = .08
    

    When you round up to the next whole page, only one SMP will be needed.

  5. Add the number of base pages and space management pages to determine the number of pages in the area: 173
  6. Divide the number of pages in the area by the number of pages per track on the type of disk device being used. The result is the number of tracks needed:
    173 / 10 = 17.3 tracks