The Globex company core production department has these requirements:
- 8 AM to noon: Response-time Service Level Agreements (SLAs) for interactive business intelligence and reporting
- Noon to 5 PM: Unpredictable number of users and workload
- 5 PM to 8 AM: Few users, low workload
To minimize unused resources, the compute cluster administrator creates the following compute group and compute profiles:
CREATE COMPUTE GROUP Globex_Department
USING QUERY_STRATEGY ('STANDARD');
CREATE COMPUTE PROFILE SLA_Resources IN Globex_Department, INSTANCE = TD_COMPUTE_LARGE -- 4 x default SLA USING MIN_COMPUTE_COUNT (3) -- 3 x default query capacity (~30 queries) MAX_COMPUTE_COUNT (5) -- Query capacity elastic to 5 x default (~50 queries) START_TIME (' 45 14 * * * ') -- Start compute cluster at 7:45 AM PST END_TIME (' * 19 * * * ') -- Stop compute cluster at 12:00 PM PST COOLDOWN_PERIOD (30);
CREATE COMPUTE PROFILE Elastic_Resources IN Globex_Department, INSTANCE = TD_COMPUTE_MEDIUM -- 2 x default SLA USING MIN_COMPUTE_COUNT (2) -- 2 x default query capacity (~20 queries) MAX_COMPUTE_COUNT (4) -- Query capacity elastic to 4 x default (~40 queries) START_TIME (' 45 18 * * * ') -- Start compute cluster at 11:45 AM PST END_TIME (' * 0 * * * ') -- Stop compute cluster at 5:00 PM PST COOLDOWN_PERIOD (30);
CREATE COMPUTE PROFILE Evening_Resources IN Globex_Department, INSTANCE = TD_COMPUTE_SMALL -- Default SLA USING MIN_COMPUTE_COUNT (1) -- Default query capacity (~10 queries) MAX_COMPUTE_COUNT (2) -- Query capacity elastic to 2 x default (~20 queries) START_TIME (' 45 23 * * * ') -- Start compute cluster at 4:45 PM PST END_TIME (' * 15 * * * ') -- Stop compute cluster at 8:00 AM PST COOLDOWN_PERIOD (30);
INSTANCE sets the SLA (size) of the compute profile compute clusters.
MIN_COMPUTE_COUNT and MAX_COMPUTE_COUNT set the minimum and maximum number of active compute clusters for the compute profile.
START_TIME and END_TIME set the time that the compute profile starts and stops being active. The active times overlap. Overlap and COOLDOWN_PERIOD allow smooth transition between compute profiles. If two compute profiles have active compute clusters that can run a query, the query runs on the larger compute cluster.