DB2 Version 9.7 for Linux, UNIX, and Windows

SNAPBP administrative view and SNAP_GET_BP_V95 table function - Retrieve bufferpool logical group snapshot information

The SNAPBP administrative view and the SNAP_GET_BP_V95 table function return information about buffer pools from a bufferpool snapshot, in particular, the bufferpool logical data group.

SNAPBP administrative view

This administrative view allows you to retrieve bufferpool logical group snapshot information for the currently connected database.

Used with the SNAPBP_PART administrative view, the SNAPBP administrative view provides the data equivalent to the GET SNAPSHOT FOR BUFFERPOOLS ON database-alias CLP command.

The schema is SYSIBMADM.

Refer to Table 1 for a complete list of information that can be returned.

Authorization

One of the following authorizations is required:
  • SELECT privilege on the SNAPBP administrative view
  • CONTROL privilege on the SNAPBP administrative view
  • DATAACCESS authority
In addition, one of the following privileges or authorities is also required:
  • EXECUTE privilege on the SNAP_GET_BP_V95 table function
  • DATAACCESS authority
In addition, to access snapshot monitor data, one of the following authorities is also required:
  • SYSMON
  • SYSCTRL
  • SYSMAINT
  • SYSADM

Example

Retrieve data and index writes for all the bufferpools of the currently connected database.
SELECT SUBSTR(DB_NAME,1,8) AS DB_NAME,SUBSTR(BP_NAME,1,15) 
   AS BP_NAME,POOL_DATA_WRITES,POOL_INDEX_WRITES 
   FROM SYSIBMADM.SNAPBP
The following example is a sample output from this query.
DB_NAME  BP_NAME         POOL_DATA_WRITES     POOL_INDEX_WRITES 
-------- --------------- -------------------- --------------------
TEST     IBMDEFAULTBP                       0                    0
TEST     IBMSYSTEMBP4K                      0                    0
TEST     IBMSYSTEMBP8K                      0                    0
TEST     IBMSYSTEMBP16K                     0                    0
TEST     IBMSYSTEMBP32K                     0                    0

5 record(s) selected 

SNAP_GET_BP_V95 table function

The SNAP_GET_BP_V95 table function returns the same information as the SNAPBP administrative view, but allows you to retrieve the information for a specific database on a specific database partition, aggregate of all database partitions or all database partitions.

Used with the SNAP_GET_BP_PART table function, the SNAP_GET_BP_V95 table function provides the data equivalent to the GET SNAPSHOT FOR ALL BUFFERPOOLS CLP command.

Refer to Table 1 for a complete list of information that can be returned.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-SNAP_GET_BP_V95--(--dbname--+------------------+--)---------><
                               '-, dbpartitionnum-'      

The schema is SYSPROC.

Table function parameters

dbname
An input argument of type VARCHAR(128) that specifies a valid database name in the same instance as the currently connected database. Specify a database name that has a directory entry type of either "Indirect" or "Home", as returned by the LIST DATABASE DIRECTORY command. Specify an empty string to take the snapshot from the currently connected database. Specify a NULL value to take the snapshot from all databases within the same instance as the currently connected database.
dbpartitionnum
An optional input argument of type INTEGER that specifies a valid database partition number. Specify -1 for the current database partition, or -2 for an aggregate of all active database partitions. If dbname is not set to NULL and dbpartitionnum is set to NULL, -1 is set implicitly for dbpartitionnum. If this input option is not used, that is, only dbname is provided, data is returned from all active database partitions. An active database partition is a partition where the database is available for connection and use by applications.

If both dbname and dbpartitionnum are set to NULL, an attempt is made to read data from the file created by SNAP_WRITE_FILE procedure. Note that this file could have been created at any time, which means that the data might not be current. If a file with the corresponding snapshot API request type does not exist, then the SNAP_GET_BP_V95 table function takes a snapshot for the currently connected database and database partition number.

Authorization

One of the following authorizations is required:
  • EXECUTE privilege on the SNAP_GET_BP_V95 table function
  • DATAACCESS authority
In addition, to access snapshot monitor data, one of the following authorities is also required:
  • SYSMON
  • SYSCTRL
  • SYSMAINT
  • SYSADM

Example

Retrieve total physical and logical reads for all bufferpools for all active databases for the currently connected database partition.
SELECT SUBSTR(T.DB_NAME,1,10) AS DB_NAME, 
   SUBSTR(T.BP_NAME,1,20) AS BP_NAME, 
   (T.POOL_DATA_L_READS+T.POOL_INDEX_L_READS) AS TOTAL_LOGICAL_READS, 
   (T.POOL_DATA_P_READS+T.POOL_INDEX_P_READS) AS TOTAL_PHYSICAL_READS, 
   T.DBPARTITIONNUM 
   FROM TABLE(SNAP_GET_BP_V95(CAST(NULL AS VARCHAR(128)), -1)) AS T
The following example is a sample output from this query.
DB_NAME    BP_NAME          TOTAL_LOGICAL_READS  ...
---------- ------------...- -------------------- ...
SAMPLE     IBMDEFAULTBP                        0 ...
TOOLSDB    IBMDEFAULTBP                        0 ...
TOOLSDB    BP32K0000                           0 ...
                                                    
  3 record(s) selected.                             
Output from this query (continued).
... TOTAL_PHYSICAL_READS DBPARTITIONNUM
... -------------------- --------------
...                    0              0
...                    0              0
...                    0              0

Information returned

Table 1. Information returned by the SNAPBP administrative view and the SNAP_GET_BP_V95 table function
Column name Data type Description or corresponding monitor element
SNAPSHOT_TIMESTAMP TIMESTAMP snapshot_timestamp - Snapshot timestamp monitor element
BP_NAME VARCHAR(128) bp_name - Buffer pool name
DB_NAME VARCHAR(128) db_name - Database name
DB_PATH VARCHAR(1024) db_path - Database path
INPUT_DB_ALIAS VARCHAR(128) input_db_alias - Input database alias
POOL_DATA_L_READS BIGINT pool_data_l_reads - Buffer pool data logical reads
POOL_DATA_P_READS BIGINT pool_data_p_reads - Buffer pool data physical reads
POOL_DATA_WRITES BIGINT pool_data_writes - Buffer pool data writes
POOL_INDEX_L_READS BIGINT pool_index_l_reads - Buffer pool index logical reads
POOL_INDEX_P_READS BIGINT pool_index_p_reads - Buffer pool index physical reads
POOL_INDEX_WRITES BIGINT pool_index_writes - Buffer pool index writes
POOL_XDA_L_READS BIGINT pool_xda_l_reads - Buffer Pool XDA Data Logical Reads
POOL_XDA_P_READS BIGINT pool_xda_p_reads - Buffer Pool XDA Data Physical Reads
POOL_XDA_WRITES BIGINT pool_xda_writes - Buffer Pool XDA Data Writes
POOL_READ_TIME BIGINT pool_read_time - Total buffer pool physical read time
POOL_WRITE_TIME BIGINT pool_write_time - Total buffer pool physical write time
POOL_ASYNC_DATA_READS BIGINT pool_async_data_reads - Buffer pool asynchronous data reads
POOL_ASYNC_DATA_WRITES BIGINT pool_async_data_writes - Buffer pool asynchronous data writes
POOL_ASYNC_INDEX_READS BIGINT pool_async_index_reads - Buffer pool asynchronous index reads
POOL_ASYNC_INDEX_WRITES BIGINT pool_async_index_writes - Buffer pool asynchronous index writes
POOL_ASYNC_XDA_READS BIGINT pool_async_xda_reads - Buffer Pool Asynchronous XDA Data Reads
POOL_ASYNC_XDA_WRITES BIGINT pool_async_xda_writes - Buffer Pool Asynchronous XDA Data Writes
POOL_ASYNC_READ_TIME BIGINT pool_async_read_time - Buffer pool asynchronous read time
POOL_ASYNC_WRITE_TIME BIGINT pool_async_write_time - Buffer pool asynchronous write time

POOL_ASYNC_DATA_
   READ_REQS

BIGINT pool_async_data_read_reqs - Buffer pool asynchronous read requests

POOL_ASYNC_INDEX_
   READ_REQS

BIGINT pool_async_index_read_reqs - Buffer pool asynchronous index read requests

POOL_ASYNC_XDA_
   READ_REQS

BIGINT pool_async_xda_read_reqs - Buffer Pool Asynchronous XDA Read Requests
DIRECT_READS BIGINT direct_reads - Direct reads from database
DIRECT_WRITES BIGINT direct_writes - Direct writes to database
DIRECT_READ_REQS BIGINT direct_read_reqs - Direct read requests
DIRECT_WRITE_REQS BIGINT direct_write_reqs - Direct write requests
DIRECT_READ_TIME BIGINT direct_read_time - Direct read time
DIRECT_WRITE_TIME BIGINT direct_write_time - Direct write time
UNREAD_PREFETCH_PAGES BIGINT unread_prefetch_pages - Unread prefetch pages
FILES_CLOSED BIGINT files_closed - Database files closed
POOL_TEMP_DATA_L_READS BIGINT pool_temp_data_l_reads - Buffer pool temporary data logical reads
POOL_TEMP_DATA_P_READS BIGINT pool_temp_data_p_reads - Buffer pool temporary data physical reads
POOL_TEMP_INDEX_L_READS BIGINT pool_temp_index_l_reads - Buffer pool temporary index logical reads
POOL_TEMP_INDEX_P_READS BIGINT pool_temp_index_p_reads - Buffer pool temporary index physical reads
POOL_TEMP_XDA_L_READS BIGINT pool_temp_xda_l_reads - Buffer Pool Temporary XDA Data Logical Reads
POOL_TEMP_XDA_P_READS BIGINT pool_temp_xda_p_reads - Buffer Pool Temporary XDA Data Physical Reads monitor element
POOL_NO_VICTIM_BUFFER BIGINT pool_no_victim_buffer - Buffer pool no victim buffers
PAGES_FROM_BLOCK_IOS BIGINT pages_from_block_ios - Total number of pages read by block I/O
PAGES_FROM_VECTORED_IOS BIGINT pages_from_vectored_ios - Total pages read by vectored I/O
VECTORED_IOS BIGINT vectored_ios - Number of vectored I/O requests
DBPARTITIONNUM SMALLINT The database partition from which the data was retrieved for this row.