-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve documentation of Presto Resource Groups
- Loading branch information
1 parent
6c9b457
commit 2436043
Showing
4 changed files
with
524 additions
and
201 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
presto-docs/src/main/sphinx/admin/resource-groups-example1.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--This script first creates a database named presto_resource_groups and then | ||
--creates the resource_groups_global_properties, resource_groups, and selectors tables within that database. | ||
--It then inserts some example data into these tables. | ||
|
||
--Please remember to replace 'user' with the actual username in your environment. | ||
-- Also note that this is a simple example and may not cover all your use cases. | ||
-- Always refer to the official PrestoDB documentation for the most accurate and up-to-date information. | ||
CREATE DATABASE IF NOT EXISTS presto_resource_groups; | ||
USE presto_resource_groups; | ||
|
||
CREATE TABLE IF NOT EXISTS resource_groups_global_properties ( | ||
name VARCHAR(128) NOT NULL PRIMARY KEY, | ||
value VARCHAR(512) NOT NULL, | ||
UNIQUE (name) | ||
); | ||
|
||
INSERT INTO resource_groups_global_properties (name, value) | ||
VALUES ('cpu_quota_period', '1h'); | ||
|
||
CREATE TABLE IF NOT EXISTS resource_groups ( | ||
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
name VARCHAR(128) NOT NULL, | ||
soft_memory_limit VARCHAR(128) NOT NULL, | ||
hard_concurrency_limit INT NOT NULL, | ||
max_queued INT NOT NULL, | ||
jmx_export BOOLEAN NOT NULL, | ||
soft_cpu_limit VARCHAR(128), | ||
hard_cpu_limit VARCHAR(128), | ||
scheduling_policy VARCHAR(128), | ||
scheduling_weight INT, | ||
parent_id BIGINT, | ||
environment VARCHAR(128), | ||
UNIQUE (name, environment) | ||
); | ||
|
||
INSERT INTO resource_groups (name, soft_memory_limit, hard_concurrency_limit, max_queued, jmx_export) | ||
VALUES ('global', '80%', 100, 1000, true); | ||
|
||
INSERT INTO resource_groups (name, soft_memory_limit, hard_concurrency_limit, max_queued, jmx_export, parent_id) | ||
VALUES ('user', '50%', 50, 500, false, LAST_INSERT_ID()); | ||
|
||
CREATE TABLE IF NOT EXISTS selectors ( | ||
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
resource_group_id BIGINT NOT NULL, | ||
user_regex VARCHAR(512), | ||
source_regex VARCHAR(512), | ||
query_type VARCHAR(512), | ||
priority INT NOT NULL, | ||
UNIQUE (resource_group_id, priority) | ||
); | ||
|
||
INSERT INTO selectors (resource_group_id, user_regex, priority) | ||
VALUES (LAST_INSERT_ID(), 'user', 1); |
Oops, something went wrong.