PostgreSQL Bloat Growth Test

PostgreSQL bloat growth refers to the accumulation of unallocated or dead space within database tables and indexes. This phenomenon is primarily driven by frequent UPDATE and DELETE operations coupled with suboptimal vacuuming cycles. Left unchecked, bloat results in inefficient storage utilization, degraded query performance, and overall systemic latency.

Continuous monitoring of PostgreSQL bloat growth is critical to maintaining optimal database performance, preventing excessive disk consumption, mitigating slow queries, and validating the efficacy of vacuum operations. Proactive tracking enables administrators to isolate specific tables or indexes requiring immediate maintenance, thereby enhancing long-term database health, stability, and resource utilization.

The purpose of this test is to monitor PostgreSQL bloat growth by simulating updates and deletes, assessing table and index space usage, validating autovacuum efficiency, identifying performance impact, and ensuring timely maintenance actions to maintain optimal database performance and storage utilization.

Target of the test : PostgreSQL server

Agent deploying the test: An internal/remote agent

Outputs of the test : One set of results for the target PostgreSQL server

v

Configurable parameters for the test
Parameter Description

Test period

How often should the test be executed

Host

The IP address of the host for which this test is to be configured.

Port

The port on which the server is listening. The default port is 5432.

Username

In order to monitor a PostgreSQL server, you need to manually create a special database user account in every PostgreSQL database instance that requires monitoring. To know how to create such a user based on where the target PostgreSQL server is installed (whether on-premises or hosted on Cloud), refer to How does eG Enterprise Monitor PostgreSQL Server?.

Password

The password associated with the above Username (can be ‘NULL’). Here, ‘NULL’ means that the user does not have any password.

Confirm Password

Confirm the Password (if any) by retyping it here.

DB Name

The name of the database to connect to. The default is “postgres”.

Include DB

Specify a comma-separated list of databases that need to be included in monitoring in the Include DB text box. By default, this is set to ALL.

Exclude DB

Specify a comma-separated list of databases that need to be excluded from monitoring in the Exclude DB text box. By default, this is set to rdsadmin.

Note:

If you are monitoring a PostgreSQL server hosted on AWS cloud, then make sure that you do not remove 'rdsadmin' from the Exclude DB list.

Approximate Estimation

Specify whether the eG agent should use fast, statistical estimation methods to calculate table and index bloat. Setting this flag to Yes allows the agent to quickly estimate bloat using standard database statistics without imposing a heavy I/O performance penalty on large production databases. Setting this flag to No forces a precise, block-by-block analysis which provides highly accurate bloat figures but may introduce significant query overhead. By default, this flag is set to Yes.

High Bloat Percentage Limit

By default, this test classifies those tables and indexes containing over 40% of wasted/dead space as 'highly bloated'. Accordingly, this parameter is set to 40 by default. If the bloat percentage of any table/index violates this default threshold, then such a table/index will be automatically counted as 'highly bloated', thus incrementing the value of 'Highly bloated tables' and 'Highly bloated indexes'.

Very High Bloat Percentage Limit

By default, this test classifies those tables and indexes containing over 50% of wasted/dead space within as 'very highly bloated'. Accordingly, this parameter is set to 50 by default. If the bloat percentage of any table/index violates this default threshold, then such a table/index will be automatically counted as 'very highly bloated'. thus incrementing the value of the 'Very highly bloated tables' and 'Very highly bloated indexes' measures (as the case may be). You can change this threshold based on what your environment considers as a 'very high bloat percentage'.

SSL

If the PostgreSQL server being monitored is an SSL-enabled server, then set the SSL flag to Yes. If not, then set the SSL flag to No.

Verify CA

If the eG agent is required to establish an encrypted connection with the target PostGreSQL Database server by authenticating the server's identity through verifying the server CA certificate, set Verify CA flag to Yes. By default, this flag is set to No.

CA Cert File

This parameter is applicable only if the target PostGreSQL Database is SSL-enabled.The certificate file is a public-key certificate following the x.509 standard. It contains information about the identity of the server, such as its name, geolocation, and public key. Each nodes of the target cluster can have individual certificate files or a single certificate can be used to access all the nodes in the cluster. Essentially, it’s a certificate that the server serves to the connecting users to prove that they are what they claim to be. Therefore, specify the full path to the server root certificate or certificate file that is signed by the CA in .crt file format for all/each node in the CA Cert File text box. For example, the location of this file may be: C:\app\eGurkha\JRE\lib\security\PostGreQL-test-ca.crt. By default, this parameter is set to none.

This parameter specification differs according to the type of cluster and configuration:

If the certificate file is available for each node of the PostGreSQL Cluster then, provide a comma-seperated list of full path to the certificates in CA Cert File text box:

For example:C:\app\eGurkha\JRE\lib\security\postgresql-test-ca.crt,C:\app\eGurkha\JRE\lib\security\postgresql-test-ca2.crt,C:\app\eGurkha\JRE\lib\security\postgresql-test-ca3.crt

Specify the full path to the certificate file of the target PostGreSQL Database if a single certificate is used to access all nodes.

For example: C:\app\eGurkha\JRE\lib\security\postgresql-test-ca.crt

Client Cert File

This parameter is applicable only if the target PostGreSQL Database is SSL-enabled. In order to collect metrics from the target PostgreSQL cluster, the eG agent requires client certificate in .p12 format. Hence, specify the full path to the Client certificate file in .p12 format in the Client Cert File text box. For example, the location of this file may be: C:\app\eGurkha\JRE\lib\security\test-client.p12.

Client Key File

A client key file refers to a file containing the private key that corresponds to the public key used by a client. Provide full path of the file containing client key.

Detailed Diagnosis

To make diagnosis more efficient and accurate, the eG Enterprise embeds an optional detailed diagnostic capability. With this capability, the eG agents can be configured to run detailed, more elaborate tests as and when specific problems are detected. To enable the detailed diagnosis capability of this test for a particular server, choose the On option. To disable the capability, click on the Off option.

The option to selectively enable/disable the detailed diagnosis capability will be available only if the following conditions are fulfilled:

  • The eG manager license should allow the detailed diagnosis capability
  • Both the normal and abnormal frequencies configured for the detailed diagnosis measures should not be 0.
Measurements made by the test

Measurement

Description

Measurement Unit

Interpretation

Highly bloated tables

Indicates the total number of database tables where the bloat percentage or size has crossed the initial "highly bloated" configuration threshold.

Number

A high value indicates that a widespread number of tables are accumulating dead tuples that aren't being vacuumed fast enough. This leads to increased disk I/O, slow sequential scans, and poor memory utilization as wasted space gets cached. Low value (or 0) on the other hand is ideal, indicating that your auto vacuum routines are successfully keeping up with data modifications across almost all tables.

Detailed Diagnosis of this measure will reveal additional metrics including Schema name, Table name, Index name, Total table size in mb, Live tuple count, Live tuple size in mb, Dead tuple count, Dead tuple size in mb, Free space in mb, Bloat percentage etc.

Very highly bloated tables

Tables Indicates the total number of database tables where bloat has reached critical levels, exceeding the maximum "very highly bloated" configuration threshold.

Number

A high value points to a critical performance and storage bottleneck. These tables require immediate administrative intervention (such as running pg_repack or VACUUM FULL) because regular auto-vacuum is failing to reclaim space, severely impacting transaction speeds.

Detailed Diagnosis of this measure will reveal additional metrics including Schema name, Table name, Index name, Total table size in mb, Live tuple count, Live tuple size in mb, Dead tuple count, Dead tuple size in mb, Free space in mb, Bloat percentage etc.

Highly bloated indexes

Indicates the total number of database indexes whose index bloat (wasted space within B-tree or other index structures) has crossed the initial warning threshold.

Number

A high value implies that many indexes are containing dead pointers. This increases the depth of index trees, causing index-scans to take significantly longer and reducing the effectiveness of your database's shared_buffers. A low value on the other hand shows that index structures remain dense, compact, and optimized for fast lookups.

Detailed Diagnosis of this measure will reveal additional metrics including Schema name, Table name, Index name, Total table size in mb, Live tuple count, Live tuple size in mb, Dead tuple count, Dead tuple size in mb, Free space in mb, Bloat percentage etc.

Very highly bloated indexes

Indicates the total number of database indexes where the structural bloat has breached critical operational thresholds.

Number

A high value represents severe index degradation. Queries utilizing these indexes will experience massive slowdowns, and the index size may unnecessarily exceed the actual data size. Immediate rebuilding of these indexes (REINDEX or concurrent reindexing) is highly recommended. A value of 0 means index efficiency across the entire database is stable and healthy.

Detailed Diagnosis of this measure will reveal additional metrics including Schema name, Table name, Index name, Total table size in mb, Live tuple count, Live tuple size in mb, Dead tuple count, Dead tuple size in mb, Free space in mb, Bloat percentage etc.