Appearance
Rule Conditions
Rules consist of one or more conditions. When satisfied, these conditions trigger rule actions. You can define different kinds of conditions in Yellowbrick Manager by selecting directly from drop-down lists or by using filter operators. The following table describes these operators.
Filter Operator | Description | Examples |
---|---|---|
Is True, Not True | Boolean condition | Query is/is not a Single Worker query |
Equals, Not Equals | Simple equality condition | Schema does not equal public ; Application equals ybsql |
Greater Than, Less Than | > or < | Cost >10000 |
Greater Than or Equal To, Less Than or Equal To | >= or <= | Memory Usage Estimate <=100 |
Contains String, Not Contains String | Simple substring operations | SQL contains union all ; User Name does not contain bob |
Matches, Not Matches | Regular expression (regex) pattern matching. Escaping is applied only when items are selected from a drop-down list. Regular expression validation is applied when entries are typed; warnings are displayed. | SQL matches sys\.const ; SQL matches sum\(substr |
Matches Ignore Case, Not Matches Ignore Case | Pattern matching as above, but with respect to case |
The following table lists the specific rule conditions that you can set up, shows which rule types support each condition, and lists the accepted values for each condition.
Filter Condition | Description | Rule Types | Accepted Values |
---|---|---|---|
Application | Application name, as sent by the application itself, or as defined for a session with a SQL SET command: set application_name <name>; | All types | Any string that does or does not match an application name, such as ybsql or ym . Note that ybload application names have the version appended, so you cannot filter on the exact string 'ybload' . |
Average CPU Usage | You can use Query Details > Statistics > RESOURCES (or UTILIZATION) in Yellowbrick Manager to find this value for past executions of a query. Alternatively, you can query the sys.log_query view. | Runtime, Completion | Any percentage value |
Bytes Network | Bytes moved internally over the network on the cluster (manager node to workers and vice versa). This number does not include data being returned to the client.Use Query Details > Statistics > RESOURCES in Yellowbrick Manager to find this value for past executions of a query. | Runtime, Completion | Positive whole numbers |
Bytes Read | Use Query Details > Statistics > RESOURCES in Yellowbrick Manager to find this value for past executions of a query. Alternatively, select io_read_bytes from sys.log_query . | Runtime, Completion | Positive whole numbers |
Bytes Written | Use Query Details > Statistics > RESOURCES in Yellowbrick Manager to find this value for past executions of a query. Alternatively, select io_write_bytes from sys.log_query . | Runtime, Completion | Positive whole numbers |
Command | Filter on a SQL command: select , update , insert , delete , or utility . | Assemble, Compile, Restart, Runtime, Completion | Select from the drop-down list. Filter on utility for CREATE TABLE commands. Note: You can define rules for INSERT INTO...SELECT statements but not for INSERT INTO...VALUES statements. INSERT INTO...VALUES operations are not executed by the backend database. |
Cost | A relative value that is set by the planner. | Compile, Restart, Runtime, Completion | Any number |
Database | Database name | All types | Select from the drop-down list. |
Error Code | Yellowbrick error code; see Error Codes and Recoverable Error Codes. | Restart, Runtime, Completion | A string that matches or does not match a specific error code. |
Error Message | Error message text. | Restart, Runtime, Completion | Any string |
Execution Duration (in ms) | Number of milliseconds the query spent during execution on the worker nodes. | Runtime, Completion | Any number |
Hostname/IP Address | Name or IP address of client machine | All types | Any string |
Max Memory (in bytes) | Maximum runtime memory. Use Query Details > Statistics > RESOURCES in Yellowbrick Manager to find this value for past executions of a query. | Runtime, Completion | Any number |
Memory Estimate (in MB) | Estimated runtime memory. Use Query Details > Statistics > RESOURCES in Yellowbrick Manager to find this value for past executions of a query. Alternatively, select memory_estimated_bytes from sys.log_query . | Compile, Restart, Runtime, Completion | Any number |
Memory Estimate Confidence | Estimated degree of confidence in the memory estimate value. | Compile, Restart, Runtime, Completion | Unknown, None, Low, High |
Priority | The CPU priority of queries starts at Normal and is only settable by rules. Priority is not an attribute of a profile or pool. Based on a condition, you can trigger an action to set the priority to a lower (Low ) or a higher (High or Critical ) priority. Priority settings are only meaningful when multiple queries are running concurrently. If only one query is running, it is allocated 100% of the available CPU, regardless of its priority. When queries are running concurrently, the percentage of CPU time increases 2-3x by priority level. For example, if you have concurrent queries set to Low and Normal , the Normal query takes approximately 75% of the CPU time, and the Low query approximately 25% (the remainder). | All types | Low, Normal, High, Critical |
Query State | Current state of the query. See How Queries Are Executed for details about query states. | All types | Any string |
Query Tags | Use query tags to classify queries, then take actions. (You can also set a tag as an action). See Using Query Tags. | All types | Any string |
Query is Movable | The query may be moved to another resource pool (and continue its execution there or be restarted there). See Moving Queries. | All types except Completion | Select a pool from the drop-down list. |
Query is Restartable | The query may be restarted in another resource pool. See Restarting Queries | All types except Completion | Is True , Not True |
Referenced Tables | Name of a table that is referenced somewhere in a query. | Compile, Runtime, Completion | Contains or Not Contains <table_name> (select from list) |
Resource Pool | Name of a WLM resource pool. See Setting and Matching Resource Pools in WLM Rules. | All types | Select a pool from the drop-down list. |
Rows Deleted | Number of rows deleted by a DELETE operation. | Runtime, Completion | Any number |
Rows Inserted | Number of rows inserted by an INSERT operation. | Runtime, Completion | Any number |
Rows Returned | Number of rows returned to the client application. | Runtime, Completion | Any number |
SQL | Any piece of SQL text that may be found in a query. You can also use this condition to check for a comment placed in a query, rather than filter on the SQL itself. | All types | Any string |
Schema | Name of a schema. | Assemble, Compile, Runtime, Completion | Select from the drop-down list. The search_path for the current session determines whether the condition applies. If a named schema is in the search_path , that is a match. |
Single Worker | Queries that only involve replicated tables are marked as “single worker” queries. | Compile, Runtime, Completion | Is True , Not True |
Temporary Bytes Read | Number of bytes read from disk because spilling occurs during the query. Select io_spill_read_bytes from sys.log_query to find this value for past executions of a query. | Runtime, Completion | Any number |
Temporary Bytes Written | Number of bytes written to disk because spilling occurs during the query. Select io_spill_write_bytes from sys.log_query to find this value for past executions of a query. | Runtime, Completion | Any number |
Total Duration (in ms) | The total time a query took to run (end time - submit time). This includes planning, compilation, and queue time. Use Query Details > Statistics > TIMING in Yellowbrick Manager to find this value for past executions of a query. Alternatively, select total_ms from sys.log_query . | Runtime, Completion | Any number |
Total Memory (in bytes) | The total amount of memory used across the cluster to run the query. Use Query Details > Statistics > UTILIZATION in Yellowbrick Manager to find this value for past executions of a query. Alternatively, select memory_total_bytes from sys.log_query . | Runtime, Completion | Any number |
Type | Type of administration operation, such as create , delete , drop , backup , restore , analyze , and ycopy . These values correspond to the type values in the sys.query and sys.log_query views. | Assemble, Compile, Runtime, Completion | Select from the drop-down list.Note: You can define rules for INSERT INTO...SELECT statements but not for INSERT INTO...VALUES statements. INSERT INTO...VALUES operations are not executed by the backend database. See also Managing the Row Store. |
User Name | Database user name | All types | Select from the drop-down list. |
User Roles | Database roles (in which a user has membership) | All types | Select from the drop-down list. |
Parent topic:Creating WLM Rules