DB2 Version 9.7 for Linux, UNIX, and Windows

Administrative views versus table functions

DB2® Version 9.5 introduced administrative views that provide an easy-to-use application programming interface to DB2 administrative functions through SQL.

The administrative views fall into three categories:
  • Views based on catalog views.
  • Views based on table functions with no input parameters.
  • Views based on table functions with one or more input parameters.

The administrative views are the preferred and only documented interfaces for the views based on catalog views and the views based on table functions with no input parameters because the table functions do not provide any additional information or performance benefits.

For administrative views based on table functions with one or more input parameters, both the administrative view and the table function can be used, each achieving a different goal:
  • The ADMINTABINFO administrative view and the ADMIN_GET_TAB_INFO_V95 table function: The administrative view retrieves information for all tables in the database. This can have a significant performance impact for large databases. The performance impact can be reduced by using the table function and specifying a schema name, table name, or both as input.
  • The PDLOGMSGS_LAST24HOURS administrative view and the PD_GET_LOG_MSGS table function: The administrative view, which retrieves notification log messages, provides quick access to data from the previous 24 hours, whereas the table function allows you to retrieve data from a specified period of time.
  • All snapshot monitor administrative views and table functions (SNAP* administrative views, SNAP_GET_* table functions): The snapshot monitor administrative views provide access to data from each database partition. The table functions provide the option to choose between data from a single database partition or data aggregated across all database partitions.

Applications that use the table functions instead of the views might need to be changed because the table functions might change from release to release to enable new information to be returned. The new table function will have the same base name as the original function and will be suffixed with '_Vxx' for the version of the product in which it is added (for example, _V97). The administrative views will always be based on the most current version of the table functions, and therefore allow for more application portability. As the columns may vary from one release to the next, it is recommended that specific columns be selected from the administrative views, or that the result set be described if a SELECT * statement is used by an application.