PostgreSQL Wait Event Types Test

Wait events are invented to capture the information of system blocks or waits to perform some action like waiting for another backend process to release the heavyweight or lightweight locks, waits to access data buffer when no other process can be examining the buffer, waits to read or write the data to disk, etc. The following list describes each of the wait event types in PoatgreSQL server.

Wait Event type Description

Activity

The server process is idle. This event type indicates a process waiting for activity in its main processing loop. wait_event will identify the specific wait point;

BufferPin

The server process is waiting for exclusive access to a data buffer. Buffer pin waits can be protracted if another process holds an open cursor that last read data from the buffer in question.

Client

The server process is waiting for activity on a socket connected to a user application. Thus, the server expects something to happen that is independent of its internal processes. wait_event will identify the specific wait point;

Extension

The server process is waiting for some condition defined by an extension module.

IO

The server process is waiting for an I/O operation to complete. wait_event will identify the specific wait point;

IPC

The server process is waiting for some interaction with another server process. wait_event will identify the specific wait point;

Lock

The server process is waiting for a heavyweight lock. Heavyweight locks, also known as lock manager locks or simply locks, primarily protect SQL-visible objects such as tables. However, they are also used to ensure mutual exclusion for certain internal operations such as relation extension. wait_event will identify the type of lock awaited;

LWLock

The server process is waiting for a lightweight lock. Most such locks protect a particular data structure in shared memory. wait_event will contain a name identifying the purpose of the lightweight lock. (Some locks have specific names; others are part of a group of locks each with a similar purpose.)

Timeout

The server process is waiting for a timeout to expire. wait_event will identify the specific wait point;

Since wait events are resource-drains and serious performance degraders, administrators need to keep a close eye on these wait event types, figure out how much time the PostgreSQL database server actually spends waiting for each type, and rapidly decipher why, so that measures can be initiated to minimize these events. To achieve this, you can use the PostgreSQL Wait Event Types Test. This test reports the time spent by the PostgreSQL server waiting for events of each wait event types, helps identify those wait event types with wait events that have remained active for a long time, and also reveals the number of sessions that have been impacted by the waiting. With the help of the detailed diagnostics of this test, you can also zoom into these sessions and identify the queries that they executed that may have caused wait events to occur; this way, inefficient queries can be isolated.

Target of the test : PostgreSQL server

Agent deploying the test: An internal/remote agent

Outputs of the test :One set of results for each wait event type in the target database server being monitored.

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.

Password Profile

This list box appears only if one or more password profiles are created for the target host. Typically, to protect the critical servers/services from malicious attacks by online predators, administrators of secured IT environments frequently change the access credentials for the critical servers and services. Once a password is changed, all tests that take that password as a parameter will stop working, until such time the administrator manually reconfigures each test and changes the password. To avoid such anomalies and save administrators the time and effort involved in manually changing the password of tests, eG Enterprise allows the creation of one/more password profiles. With the password profiles, administrators no longer need to manually configure the credentials; instead, they only need to select the Password Profile that contains the credentials to be passed to the test. This means that if a password changes/expires subsequently, it would suffice to change the corresponding Password Profile alone. All the tests configured with that Password Profile will automatically assume the new password.

Once, you select a password profile from the Password Profile list box, the user credentials will be automatically populated in the corresponding text boxes that follow the Password profile list box. If you do not want to use the password profiles, then, you can ignore selecting the password profile from the list box and manually configure the user credentials.

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”.

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 MongoDB 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.

DD Count

By default, the detailed diagnosis of this test reports the top-5 queries. This is why, the DDCount parameter is set to 5 by default. If you want detailed diagnosis to display less or more number of top queries, then change the DDCount.

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

Number of wait event types

Indicates the number of times wait events on this type occured in the target database server.

Number

If the value of this measure is very high, then you can drill down further using the detailed diagnosis capability (if enabled) of the eG Enterprise suite to discover which current connections may be responsible for this.

The detailed diagnosis of this measure shows that information about the PID, Waiting Username, Database name,Application name, Waiting client address, Session status, Status change time, Wait event type, Wait duration(in seconds), Query start time, and SQL text.

Maximum wait time duration

Indicates the maximum wait time for this wait event type.

Seconds

A low value is desired for this measure.

Waiting time in percentage

Indicates the percentage of total wait time (across wait event types) during which wait events on this type occurred.

Percent

Calculation =

(Sum of wait time of info / Sum of wait time all info) * 100