Disk block reads per database


Job details

Name: Disk block reads per database
Platform: Postgres
Category: Performance
Description: Collects the number of disk block fetch requests for table or index per database.
Long description: Collects the number of disk block fetch requests for table or index using the pg_stat_get_blocks_fetched and pg_stat_get_db_blocks_hit functions. The statistics are collected per database.
Version: 1.3
Default schedule: 2,12,22,32,42,52 * * *
Requires engine install: Yes
Compatibility tag: .[type=‘instance’ & databasetype=‘postgres’]/.[hasengine=‘YES’ & is_awsrds = ‘0′ & newer_than_ninefour = 1]

Parameters

Name Default value Description
keep data for 7 The number of days to keep the data for.

Job Summary

SELECT db_name, blocks_fetched, blocks_hit FROM dbw_disk_block_reads_last;

Job Description

This dbWatch Control Center job specifically targets PostgreSQL databases that are not hosted on AWS RDS and are newer than version 9.4. The job utilizes various PostgreSQL functions and custom tables to track and log the number of disk blocks fetched versus hit (from cache), allowing it to calculate the net disk blocks read per database.

Job Components and Implementation

Database Functions and Tables

The job setup includes the creation of several database entities:

Monitoring Implementation

The monitoring process involves:

Dependency Management

Dependencies are set to ensure that essential tables and functions are present and correctly set up before the job runs. Failure to meet these dependencies triggers cleanup actions.

Reporting

The job also includes a reporting template titled “Disk block hitrate” that provides a graphical representation and detailed statistics of disk reads for the most active databases over select periods. This report includes:

This dbWatch Control Center job, therefore, plays a crucial role in maintaining the performance and efficiency of PostgreSQL databases by monitoring important metrics related to disk access patterns.