Session Property Managers
Add an file with the following contents to enable the built-in manager that reads a JSON config file:
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 of conditions that the query must meet, and a list of session properties that should be applied by default. All matching rules contribute to constructing a list of session properties. Rules are applied in the order they are specified. Rules specified later in the file override values for properties that have been previously encountered.
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 manage prepared statements, privileges, sessions, and transactions.DESCRIBE
:DESCRIBE
,DESCRIBE INPUT
,DESCRIBE OUTPUT
, andSHOW
queries.EXPLAIN
:EXPLAIN
queries.INSERT
:INSERT
andCREATE TABLE AS
queries.SELECT
:SELECT
queries.
(optional): list of tags. To match, every tag in this list must be in the list of client-provided tags associated with the query.
group
(optional): regex to match against the fully qualified name of the resource group the query is routed to.clientInfo
(optional): regex to match against the client info text supplied by the clientsessionProperties
: map with string keys and values. Each entry is a system or catalog property name and corresponding value. Values must be specified as strings, no matter the actual data type.
Example
Consider the following set of requirements:
All interactive queries are routed to subgroups under the
global.interactive
group, and have an execution time limit of 1 hour (tighter than the constraint onglobal
).All ETL queries (tagged with ‘etl’) are routed to subgroups under the
global.pipeline
group, and must be configured with certain properties to control writer behavior.All high memory ETL queries (tagged with ‘high_mem_etl’) are routed to subgroups under the
global.pipeline
group, and must be configured to enable .
These requirements can be expressed with the following rules:
[
{
"group": "global.*",
"sessionProperties": {
"query_max_execution_time": "8h",
}
},
{
"group": "global.interactive.*",
"sessionProperties": {
}
},
"group": "global.pipeline.*",
"clientTags": ["etl"],
"sessionProperties": {
"scale_writers": "true",
"writer_min_size": "1GB"
}
},
{
"group": "global.pipeline.*",
"clientTags": ["high_mem_etl"],
"sessionProperties": {
"exchange_materialization_strategy": "ALL",
"partitioning_provider_catalog": "hive",
"hash_partition_count": 4096
}
}