Skip to content

sys.query_rule_event

This view captures information about WLM rule processing (as also displayed via the SMC). A single row identifies a unique rule-processing event for a specific query. Use this view to see which rules and related actions are in effect when specific queries are run.

Column NameData TypeDescription
query_idbigintQuery ID, which can be joined with the query_id column in sys.log_query or sys.query.
rule_nametextName of the WLM rule being applied. The default value of rule appears in this column for begin and end event types.
event_timetimestamptzWhen each event occurred.
event_typetextPossible values for each event are begin, disabled, end, error, ignore, info, move, set, timeout, warn
eventtextRule processing events include Rule processing starting, Rule processing complete, Setting..., Move to resource pool..., Rule is disabled, and so on.

Examples

premdb=> select * from sys.query_rule_event;
 query_id |      rule_name      |         event_time         | event_type |                 event                  
----------+---------------------+----------------------------+------------+----------------------------------------
   30108 | rule                | 2017-04-11 15:17:15.584-07 | end        | Rule processing for 30108 complete
   30108 | sys_defaultRowLimit | 2017-04-11 15:17:15.582-07 | set        | Setting MaximumRowLimit to 5000000
   30108 | fastlane            | 2017-04-11 15:17:15.581-07 | set        | Setting ResourcePool to shortquerypool
   30108 | rule                | 2017-04-11 15:17:15.578-07 | begin      | Rule processing for 30108 starting
...
premdb=> select s1.query_id, s1.query_text, s2.rule_name, s2.event_type, s2.event 
from sys.log_query s1, sys.query_rule_event s2 
where s1.query_id=s2.query_id and query_text ='select * from match;';
 query_id |       query_text       |      rule_name      | event_type |                 event                  
----------+------------------------+---------------------+------------+----------------------------------------
   33658 |  select * from match;  | rule                | end        | Rule processing for 33658 complete
   33658 |  select * from match;  | sys_defaultRowLimit | set        | Setting MaximumRowLimit to 5000000
   33658 |  select * from match;  | fastlane            | set        | Setting ResourcePool to shortquerypool
   33658 |  select * from match;  | rule                | begin      | Rule processing for 33658 starting
(4 rows)

The following example filters events in which a query was moved to another pool:

yellowbrick=# select * from sys.query_rule_event where event like 'Move%';;
 query_id |    rule_name    |         event_time         | event_type |           event            
----------+-----------------+----------------------------+------------+----------------------------
 13450004 | system          | 2020-09-24 14:39:59.967-07 | move       | Move to resource pool long
 13245785 | flex_moveToLong | 2020-09-24 12:35:18.543-07 | move       | Move to resource pool long
(2 rows)

The following example finds events for a specific completion rule when it was not disabled or ignored:

yellowbrick=# select * from sys.query_rule_event where rule_name='completion_error' and event_type not in('ignore','disabled');
 query_id |    rule_name     |         event_time         | event_type |                event                 
----------+------------------+----------------------------+------------+--------------------------------------
 13584534 | completion_error | 2020-09-24 15:59:05.644-07 | error      | Do not use the yellowbrick database!
 13583194 | completion_error | 2020-09-24 15:58:50.191-07 | error      | Do not use the yellowbrick database!
 13580925 | completion_error | 2020-09-24 15:57:36.721-07 | error      | Do not use the yellowbrick database!
 13579296 | completion_error | 2020-09-24 15:57:13.002-07 | info       | Rule changed no query settings
 13578087 | completion_error | 2020-09-24 15:57:08.935-07 | error      | Do not use the yellowbrick database!
 13577467 | completion_error | 2020-09-24 15:56:27.999-07 | info       | Rule changed no query settings
 13576070 | completion_error | 2020-09-24 15:56:13.623-07 | error      | Do not use the yellowbrick database!
 13576029 | completion_error | 2020-09-24 15:56:07.99-07  | info       | Rule changed no query settings
...

Parent topic:System Views