Controlling Structure Size to Optimize Database Performance

By default, the Enterprise Database Server assumes every structure can have a maximum of 10,000 records. In many cases, this default value is suitable, but it could be too small for your needs. If the default size is too small, then as applications update the database, limit errors occur and database processing stops because there is no room for the new information.

Using XE features, the default population for sectioned data sets remains 10,000 per data set.

In the Enterprise Database Server, the following options enable you to control how large structures can grow:

  • AREAS

    Designates the physical blocks of space (areas) allocated for a structure.

  • AREASIZE

    Designates the size of the physical blocks of space.

  • BLOCKSIZE

    Designates the size of the logical blocks of space.

  • POPULATION

    Designates the number of records in a structure.

  • MAXRECORDS

    A synonym for the POPULATION option.

Using the information you supply with these options, the Enterprise Database Server calculates how much disk space a structure can use. This does not mean that as soon as the database is generated all the allocated space is in use. Instead it means that at intervals the Enterprise Database Server checks the actual size of a structure against the limit placed on the size in the database description. And, if an application tries to add more data to the structure than there is space for the data, the Enterprise Database Server returns a limit error.

Space is always allocated in units of areas because this is the physical system unit. So if you designate the structure size by using the POPULATION or MAXRECORDS option, the Enterprise Database Server turns the value to a physical file size limit in areas. As a result, a structure might hold a different number of records than you anticipate.

As a structure is changed, the population and physical layout of the structure alters. If you delete one record and immediately insert a new record, the space used by the deleted record is normally reused. However, this is not always the case. For example, if the record being added is a variable-format record and the new record is larger than the record being deleted, the new record will occupy a new location.

The following two options can help you manage the size of structures while the database is online:

  • POPULATIONWARN

    Notifies you when a structure is approaching its maximum allowed size.

  • POPULATIONINCR

    Automatically increases the allowed size of a structure as required.

When an attempt is made to add records to a structure and there is not enough space available, a limit error occurs and the store operation does not complete. Applications can contain error-detection code for each structure to control the effects of limit errors. Without suitable error-detection code, all changes requested within the transaction that receives the limit error are lost.

Before reprocessing the failed transaction, you must make more space available in the structure to which the limit error applies.

One way of increasing the performance of a database is to minimize the occurrences of limit errors. Another way is to consolidate the space left by deleted records. The Enterprise Database Server provides several mechanisms that can help in this area, including

  • Garbage collections

    Garbage collections consolidate the space left by deleted records and make the space available for reuse by the system.

    To maximize database performance, perform garbage collections on a regular basis.

  • DASDL UPDATE or database reorganizations to increase the allowed sizes of structures

    Despite the best of planning, the initial or last estimates of likely structure size might be too low, and consolidating the space left by deleted records does not resolve the problem of the structure size reaching its physical limit. To resolve this problem, perform a DASDL UPDATE or a database reorganization and increase the allowed sizes of structures by increasing the AREAS, AREASIZE, POPULATION, or MAXRECORDS option setting.

    To maximize database performance, regularly review the settings that control structure size and increase or decrease them as appropriate. Use a product such as DBANALYZER or dbaTOOLS to perform this statistics monitoring.

  • POPULATIONWARN option

    Use this option to provide notification when a structure is approaching its designated physical limit. Using this option enables you to take appropriate action before applications start receiving limit errors. Once a population warning message occurs, schedule time for a garbage collection, or update or full reorganization as appropriate.

    When the population of a structure reaches a designated level, the database control file is automatically updated with a warning that the structure is almost full. Optionally, a message is also sent to the operator display terminal (ODT) as a task that is placed in the waiting mix. (This mechanism for displaying the task helps ensure that the message does not disappear without someone seeing it.)

    On a regular basis, check for these warning messages, and if they occur, schedule time to increase the population specifications as appropriate. Once the population specifications are modified, the Enterprise Database Server automatically resets the population warning information in the database control file.

  • POPULATIONINCR option

    Use this option to automatically increase the size of a structure when it reaches the currently designated size limit. The allowed structure size is increased automatically without having to bring down the database.

    Using this option you can avoid unplanned database downtime. However, performance might decrease because the Enterprise Database Server cannot optimize the table balancing for indexing structures when increasing the data set size with the automatic population increase mechanism.

    When the population of a structure is automatically increased, the database control file is updated automatically with information regarding the population size changes. A message is also sent to the operator display terminal (ODT) as a task that is placed in the waiting mix. (This mechanism for displaying the task helps ensure that the message does not disappear without someone seeing it.)

    On a regular basis, check for these automatic population increase messages, and if they occur, schedule time to increase the population specifications as appropriate. Once the population specifications are modified, the Enterprise Database Server automatically resets the population increase information in the database control file.

Set the population-related options in one of two ways:

  • At the database level by using the DEFAULTS specification (described in Using the Defaults Specification).

  • At the structure level by using the appropriate options in the data set specification (syntax for setting the population-related options at this level are provided in Data Set Declaration).

Use the population-related options in the DEFAULTS specification to set up your requirements for your “average” structures. And then use the data set specification to set up the requirements for the “special case” structures. Individual data set specifications override the settings in the DEFAULTS specification.

To view additional information on performing garbage collections and update reorganizations, refer to the Enterprise Database Server Utilities Operations Guide .