$v_hist_queries, $v_hist_successful_queries, and $v_hist_unsuccessful_queries

The $v_hist_queries view shows information about the completed queries and their status, runtime seconds (for total, cumulative queued, prep time and GRA time), and number of plans. The $v_hist_successful_queries and $v_hist_unsuccessful_queries views show the same information as $v_hist_queries, but filters that information depending on whether each query was successful.

Table 1. $v_hist_queries, $v_hist_successful_queries, and $v_hist_unsuccessful_queries
Name Description
npsid A unique ID for the system. This value is generated as a sequence on the target database where this view is defined.
npsinstanceid The instance ID of the nzstart command for the source Netezza Performance Server system.
opid Operation ID, which is used as a foreign key from query epilog, overflow and plan, table, column access tables.
logentryid This ID and the NPS ID (npsid) and instance ID (npsinstanceid) form a foreign key into the hist_log_entry_n table.
sessionid The session ID. This ID is NULL for a failed authentication.
dbname The name of the database to which the session is connected.
queryid The unique checksum of the query.
query The first 8 KB of the query text.
submittime The time the query was submitted to Postgres.
finishtime The time when the query execution finished and Postgres has the results. The query could still be returning the results to the client after this time.
runtime
runtime_seconds

The total query run time (as interval and in seconds).
status
verbose_status
The Query Completion status (as integer and text string).
queuetime
queued_seconds
The amount of time the query was queued (as interval and in seconds).
preptime
prep_seconds
The amount of time the query spent in "prep" stage (as interval and in seconds).
gratime
gra_seconds
The amount of time that the query spent in GRA (as interval and in seconds).
numplans The number of plans generated.
numrestarts The cumulative number of times the plans were restarted.
client_user_id The user ID under which the application that submitted the query. This field is available only in database version 3 or later.
client_application_name The name of the application that submitted the query associated with the plan. This value is specified for the session, and is usually set by an application. This field is available only in database version 3 or later.
client_workstation_name The host name of the workstation on which the application that submitted the query associated with the plan runs. This value is specified for the session, and is usually set by an application. This field is available only in database version 3 or later.
client_accounting_string The value of the accounting string. This value is specified for the session, and is usually set by an application. This field is available only in database version 3 or later.