db2top Tablespaces Screen (Part 1)

Rack of hard disksDatabases are generally concerned with storing data on disk and retrieving it quickly, which makes monitoring the speed of your reads and writes essential. It is also important to know how fast your storage needs are growing, the makeup of your workload (writes versus reads), and whether data is being efficiently cached in memory. All of this information is available to you on the Tablespaces screen of db2top. In today’s post, we’ll take a look at some of the aggregates that db2top computes for you across all of your tablespaces. You’ll see how it’s possible to have a hit ratio of 90% while at the same time having an average hit ratio of only about 50%.

The Tablespaces screen is a typical db2top screen, with a block of gauges at the top and a table of table spaces and their attributes beneath it. When the screen is between 80 and 140 columns wide, the block of gauges contains a single gauge for Hit Ratio.

db2top Tablespaces screen (80 columns wide)
Gauge Name Gauge Type Definition
Hit Ratio Normal The percentage of requests for pages (data or index) from buffer pools, measured across all table spaces, that were serviced without requiring a physical read from a table space container.

(1 – sum(pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads) / sum(pool_data_l_reads + pool_index_l_reads + pool_temp_data_l_reads + pool_temp_index_l_reads)) × 100%, where sum() means measuring across all table spaces

However, once you increase the width to 141 or more columns, the screen changes to something like the following:

db2top Tablespaces screen (140 columns wide)

Several more gauges appear:

Gauge Name Gauge Type Definition
Data Hit% Normal The percentage of requests for data pages from buffer pools, measured across all regular and large table spaces, that were serviced without the need for a physical read from a table space container.

(1 – sum(pool_data_p_reads) / sum(pool_data_l_reads)) × 100%, where sum() means measuring across all regular and large table spaces

Idx Hit% Normal The percentage of requests for index pages from buffer pools, measured across all regular and large table spaces, that were serviced without the need for a physical read from a table space container.

(1 – sum(pool_index_p_reads) / sum(pool_index_l_reads)) × 100%, where sum() means measuring across all regular and large table spaces

Temp Hit% Normal The percentage of requests for data pages from buffer pools, measured across all temporary table spaces, that were serviced without the need for a physical read from a table space container.

(1 – sum(pool_temp_data_p_reads + pool_temp_index_p_reads) / sum(pool_temp_data_l_reads + pool_temp_index_l_reads)) × 100%, where sum() means measuring across all temporary table spaces

rw/sec Average Seconds
Width of sequence of ‘r’ characters:
sum(pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads + direct_reads) / average(sum(pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads + direct_reads) + sum(pool_data_writes + pool_index_writes + direct_writes))
Width of sequence of ‘w’ characters:
sum(pool_data_writes + pool_index_writes + direct_writes) / average(sum(pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads + direct_reads) + sum(pool_data_writes + pool_index_writes + direct_writes))

where:

sum()
means summing across all table spaces
average()
means averaging over the samples taken since the last snapshot reset or database activation

A second block of gauges appears to the left of the main block of gauges and a list of aggregates appears to the right. The only gauge on the left is labeled IoType.

db2top Tablespaces screen IoType gauge

Gauge Name Gauge Type Definition
IoType IO Breakdown

The first line of the gauge presents two pieces of data:

1. Reads
Character: “r”
Color: Red
Formula: sum(pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads + direct_reads), where sum() means summing across all table spaces
2. Writes
Character: “w”
Color: Yellow
Formula: sum(pool_data_writes + pool_index_writes + direct_writes), where sum() means summing across all table spaces

The second line presents three pieces of data:

1. Data
Character: “d”
Color: Magenta
Formula: sum(pool_data_l_reads), where sum() means summing across all table spaces
2. Index
Character: “i”
Color: Yellow
Formula: sum(pool_index_l_reads), where sum() means summing across all table spaces
3. Temp
Character: “t”
Color: Green
Formula: sum(pool_temp_data_l_reads + pool_temp_index_l_reads), where sum() means summing across all table spaces

The length of each sequence of the same character is proportional to how much of the total I/O that the particular I/O subtype (reads, writes, data, index, or temp) contributes.

The aggregates on the right consist of the following:

db2top Tablespaces screen aggregates

Name Definition
Logical reads
Delta mode:
The number of requests for pages (data or index) from buffer pools per second during the last interval, measured across all table spaces (sum(pool_data_l_reads + pool_index_l_reads + pool_temp_data_l_reads + pool_temp_index_l_reads), where sum() means summing across all table spaces).
Actual mode:
The number of requests for pages (data or index) from buffer pools since the last snapshot reset or database activation, measured across all table spaces (sum(pool_data_l_reads + pool_index_l_reads + pool_temp_data_l_reads + pool_temp_index_l_reads), where sum() means summing across all table spaces).
Physical reads
Delta mode:
The number of pages per second (data or index) requested from buffer pools and read from table space containers for any table space during the last interval (sum(pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads), where sum() means summing across all table spaces).
Actual mode:
The number of pages (data or index) requested from buffer pools and read from table space containers for any table space since the last snapshot reset or database action (sum(pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads), where sum() means summing across all table spaces).
Writes
Delta mode:
The number of times per second a buffer pool page (data or index) was physically written to disk or a write operation occurred that did not use the buffer pool during the last interval (sum(pool_data_writes + pool_index_writes + direct_writes), where sum() means summing across all table spaces).
Actual mode:
The number of times a buffer pool page (data or index) was physically written to disk or a write operation occurred that did not use the buffer pool since the last snapshot reset or database activation (sum(pool_data_writes + pool_index_writes + direct_writes), where sum() means summing across all table spaces).
Hit ratio% The percentage of requests for pages (data or index) from buffer pools, measured across all table spaces, that were serviced during the last interval without requiring a physical read from a table space container.

(1 – sum(pool_data_p_reads + pool_index_p_reads + pool_temp_data_p_reads + pool_temp_index_p_reads) / sum(pool_data_l_reads + pool_index_l_reads + pool_temp_data_l_reads + pool_temp_index_l_reads)) × 100%, where sum() means measuring across all table spaces

Avg Hit Ratio% Similar to Hit ratio% above but weighting all table space hit ratios equally. For example, if table space TS1 had 1 hit in 10 requests and table space TS2 had 89 hits in 90 requests, the Hit ratio% would be (1 + 89) / (10 + 90) = 90% and the Avg Hit Ratio% would be (1/10 + 89/90) / 2 = 54%.
Abnormal The number of table spaces whose state (tablespace_state) is not NORMAL (SQLB_NORMAL in sqlutil.h). This row is not shown when all table spaces are in the NORMAL state. The text is shown in red.
Temp space used The total amount of space, expressed as a multiple of bytes (e.g. KB, MB, etc.), that is currently in use by user or system temporary table spaces (sum(tablespace_used_pages × tablespace_page_size), where sum() means summing across all user and system temporary table spaces).

In part 2, we will examine the individual table spaces themselves as they appear in the table below the gauge section.

  • PAul

    Hi Keith,
    How do I increase the width to 140 or more columns?

    regards

  • thekguy

    Hi, when I mention increasing the width to 140 columns or more, I'm making the assumption that you are running db2top within some kind of xterm and I only mean to say that you would expand the width of your xterm to 140 columns.