Querying Workload Manager Record Data

The gp_wlm_records table contains a record of events describing where, why, and how the gpdb_record action was triggered by a rule on the Greenplum cluster.

The gp_wlm_records table is created in the postgres database by default. A different database can be specified at installation time with with the --dbname-records installation option.

The table has the following structure:

Column Type
time text
state text
ident text
hostname text
query_start text
message text
pid integer
session_id integer
gpdb_segment_role text
usename text
current_query text
rule text
context_args text

The primary identifier of each entry in the table is the ident column. This column stores a unique identifier that represents a specific rule that triggered on a specific node in the cluster. If a rule triggers on more than one node in the cluster at the same time, each node is treated as a separate event and receives a unique identifier.

Following are two sample entries from the gp_wlm_records table. In this example, a rule was created to track when a query runs for more than 120 seconds:

=# \x on
Expanded display is on.
=# select * from  gp_wlm_records;
-[ RECORD 1 ]-----+-----------------------------------------------------------------------------------------
time              | Fri Jun 17 14:30:27 2016
state             | BEGIN
ident             | 36b3369d-0be8-4d98-b116-6d55f1caf122
hostname          | sdw2
query_start       | 2016-06-17 14:28:24.162044-07
message           | Query exceeds 120 seconds.
pid               | 98885
session_id        | 1112
gpdb_segment_role | GPDB_SEGMENT
usename           | gpadmin
current_query     | delete from test where f1();
rule              | gpdb_record(message="Query exceeds 120 seconds.") when session_id:host:pid:runtime > 120
context_args      | runtime=121
-[ RECORD 2 ]-----+-----------------------------------------------------------------------------------------
time              | Fri Jun 17 14:31:07 2016
state             | END
ident             | 36b3369d-0be8-4d98-b116-6d55f1caf122
hostname          | 
query_start       | 
message           | 
pid               | 
session_id        | 
gpdb_segment_role | 
usename           | 
current_query     | 
rule              | 
context_args      | 

In the above example, the state column represents when a query began triggering a rule on a given node and when it stopped. The hostname column stores the host on which the rule triggered.