Workload management

The workload manager limits and controls how many queries can run concurrently at a time for a better resource usage.

Only the SELECT, UPDATE, INSERT, and DELETE commands are managed by the workload manager. All other commands, such as ANALYZE and VACUUM, are ignored.

Settings

swarm64da.enable_workload_manager (boolean)

Explicitly enable or disable the workload manager. The default is off. Only a superuser can set this parameter.

swarm64da.workload_manager_max_concurrent_queries (integer)

Set the maximum number of queries that can concurrently run on the system. New queries above this limit will be blocked until they are canceled or one of the running queries ends. The wait time counts towards any configured statement timeout. All queries that are issued by the same connection, such as cursors or queries issued by a PL/pgSQL function, are considered the same query. The default value is equal to max_worker_processes / 2.

Set this parameter in the postgresql.conf file.

swarm64da.workload_manager_bypass_cost (integer)

Set a threshold below which queries bypass the workload manager. Queries with a total plan cost greater than or equal to this parameter are managed by the workload manager. Those lower than this value are ignored. The default value is 10000. Only a superuser can set this parameter.

Functions

SELECT * FROM swarm64da.get_workload_manager_stats()

Displays the number of queries waiting in the queue, and the number of queries running at the moment.