WLM Dynamic Memory Allocation
In each queue, WLM creates a number of query slots equal to the queue's concurrency level. The amount of memory allocated to a query slot equals the percentage of memory allocated to the queue divided by the slot count. If you change the memory allocation or concurrency, Amazon Redshift dynamically manages the transition to the new WLM configuration so that active queries can run to completion using the currently allocated amount of memory, at the same time ensuring that total memory usage never exceeds 100 percent of available memory.
The workload manager uses the following process to manage the transition.
WLM recalculates the memory allocation for each new query slot.
If a query slot is not actively being used by a running query, WLM removes the slot, which makes that memory available for new slots.
If a query slot is actively in use, WLM waits for the query to finish.
As active queries complete, the empty slots are removed and the associated memory is freed.
As enough memory becomes available to add one or more slots, new slots are added.
When all queries that were running at the time of the change finish, the slot count equals the new concurrency level, and the transition to the new WLM configuration is complete.
In effect, queries that are running when the change takes place continue to use the original memory allocation, and queries that are queued when the change takes place are routed to new slots as they become available.
If the WLM dynamic properties are changed during the transition process, WLM immediately begins to transition to the new configuration, starting from the current state. To view the status of the transition, query the STV_WLM_SERVICE_CLASS_CONFIG system table.