Saving access paths

When you restore a database file, but you did not save the access path to the database, the system rebuilds the access path. You can significantly reduce the amount of time it takes you to recover if you save the access paths. However, the process that saves access paths increases the time for the save operation and the amount of media that you use.

To save access paths that are owned by logical files, specify ACCPTH(*YES) on the SAVCHGOBJ, SAVLIB, and SAVOBJ commands when you save the physical files. The system saves access paths when you save the physical file because the physical file contains the data that is associated with the access path. When you save the logical file, you are saving only the description of the logical file.

When a save command (SAVLIB, SAVOBJ, SAVCHGOBJ, SAVRSTLIB, SAVRSTOBJ, or SAVRSTCHG) is performed, the save access paths parameter value is determined by the QSAVACCPTH system value when ACCPTH(*SYSVAL) is specified. When ACCPTH(*YES) or ACCPTH(*NO) is specified, this system value is ignored. If access paths are to be saved, the process that saves access paths increases the time for the save operation and the amount of media that you use. However, by having the access paths saved, you significantly reduce the amount of time it takes to recover a system because the access paths do not need to be rebuilt.

The system saves access paths that logical files own, and that are not used for referential constraints if all of the following are true:

  • You specify ACCPTH(*YES) on the save command for the physical files.
  • All based-on physical files under the logical file are in the same library, contain data, and are being saved at the same time on the same save command.
  • The logical file is MAINT(*IMMED) or MAINT(*DLY).

In all cases, the system saves an access path only if it is valid and not damaged at the time of the save operation.

When you save a physical file that is not a source file, the system saves the following types of access paths with it, even if you do or do not specify ACCPTH(*YES):

  • Keyed access paths that are owned by the physical file
  • Primary key constraints
  • Unique constraints
  • Referential constraints

If the based-on physical files and the logical files are in different libraries, the system saves the access paths. However, the system might not restore these access paths.