query_max_workers¶
query_max_workers sets the maximum number of worker CNs used to execute a query, where 0 selects the whole eligible worker pool automatically.
Description¶
query_max_workers is a session-scoped integer system variable that caps the number of worker CNs a query can use. When the value is 0 (the default), the scheduler selects the whole eligible pool automatically. A positive value restricts the query to at most that many workers.
The variable can also be set per statement with an optimizer hint such as /*+ SET_VAR(query_max_workers=4) */.
Syntax¶
SET query_max_workers = {0 | number_of_workers}
Arguments¶
query_max_workers takes a single value: 0 (use the whole eligible worker pool, the default) or a positive integer that caps the number of worker CNs.
Examples¶
DROP DATABASE IF EXISTS query_max_workers_demo;
CREATE DATABASE query_max_workers_demo;
USE query_max_workers_demo;
SET query_max_workers = 4;
SELECT @@session.query_max_workers;
SET query_max_workers = 0;
DROP DATABASE query_max_workers_demo;