4.6. Session Property Managers

Administrators can add session properties to control the behavior for subsets of their workload.These properties are defaults and can be overridden by users (if authorized to do so). Sessionproperties can be used to control resource usage, enable or disable features, and change querycharacteristics. Session property managers are pluggable.

Add an etc/session-property-config.properties file with the following contents to enablethe built-in manager that reads a JSON config file:

  1. session-property-config.configuration-manager=file
  2. session-property-manager.config-file=etc/session-property-config.json

Change the value of session-property-manager.config-file to point to a JSON config file,which can be an absolute path, or a path relative to the Presto data directory.

This configuration file consists of a list of match rules, each of which specify a list ofconditions that the query must meet, and a list of session properties that should be appliedby default. All matching rules contribute to constructing a list of session properties. Rulesare applied in the order they are specified. Rules specified later in the file override valuesfor properties that have been previously encountered.

Match Rules

  • user (optional): regex to match against user name.
  • source (optional): regex to match against source string.
    • queryType (optional): string to match against the type of the query submitted:
      • DATA_DEFINITION: Queries that alter/create/drop the metadata of schemas/tables/views, and that manageprepared statements, privileges, sessions, and transactions.
      • DELETE: DELETE queries.
      • DESCRIBE: DESCRIBE, DESCRIBE INPUT, DESCRIBE OUTPUT, and SHOW queries.
      • EXPLAIN: EXPLAIN queries.
      • INSERT: INSERT and CREATE TABLE AS queries.
      • SELECT: SELECT queries.
  • clientTags (optional): list of tags. To match, every tag in this list must be in the list ofclient-provided tags associated with the query.
  • group (optional): regex to match against the fully qualified name of the resource group the query isrouted to.
  • sessionProperties: map with string keys and values. Each entry is a system or catalog property name andcorresponding value. Values must be specified as strings, no matter the actual data type.

Example

Consider the following set of requirements:

  • All queries running under the global resource group must have an execution time limit of 8 hours.
  • All interactive queries are routed to subgroups under the global.interactive group, and have an execution timelimit of 1 hour (tighter than the constraint on global).
  • All ETL queries (tagged with ‘etl’) are routed to subgroups under the global.pipeline group, and must beconfigured with certain properties to control writer behavior.These requirements can be expressed with the following rules:
  1. [
  2. {
  3. "group": "global.*",
  4. "sessionProperties": {
  5. "query_max_execution_time": "8h",
  6. }
  7. },
  8. {
  9. "group": "global.interactive.*",
  10. "sessionProperties": {
  11. "query_max_execution_time": "1h"
  12. }
  13. },
  14. {
  15. "group": "global.pipeline.*",
  16. "clientTags": ["etl"],
  17. "sessionProperties": {
  18. "scale_writers": "true",
  19. "writer_min_size": "1GB"
  20. }
  21. }
  22. ]