ON CLUSTER clause allows altering settings profiles on a cluster, see Distributed DDL.
Replacing vs. modifying settings
ALTER SETTINGS PROFILE supports two different ways of changing the settings and the parent (inherited) profiles of a profile. They behave very differently, so it is important to pick the right one.
Replacing form: bare SETTINGS / INHERIT
A bare SETTINGS clause (without ADD, MODIFY or DROP) replaces the entire settings list and all parent profiles of the profile with exactly what you list. Anything previously present but not listed is silently dropped — there is no warning.
SETTINGS in CREATE SETTINGS PROFILE: the clause defines the complete settings list.
Incremental form: ADD / MODIFY / DROP
The ADD, MODIFY and DROP keywords change individual entries while leaving everything else on the profile untouched:
ADD SETTINGS variable = value [constraints]— adds a setting that is not yet present.MODIFY SETTINGS variable = value [constraints]— replaces a single setting’s entry. The whole entry (value and constraints) is overwritten, so re-specifyMIN/MAX/READONLY/etc. if you want to keep them.DROP SETTINGS variable [,...]— removes the listed settings.ADD PROFILES 'profile_name' [,...]/DROP PROFILES 'profile_name' [,...]— add or remove parent (inherited) profiles.DROP ALL SETTINGS/DROP ALL PROFILES— remove all settings or all parent profiles.
DROP SETTINGS a ADD SETTINGS b = 1.
SET variable = value is an alias for MODIFY SETTINGS variable = value. It is offered because SET feels natural and because typing the replacing SETTINGS clause when an incremental change was intended is a common mistake.
Examples
Override a single setting while preserving the rest of a populated profile:SHOW CREATE SETTINGS PROFILE:
Incremental vs full replacement
To change a single setting while keeping the rest, useADD SETTINGS or MODIFY SETTINGS (see examples below).
ADD vs MODIFY
BothADD SETTINGS and MODIFY SETTINGS preserve the other settings in the profile, but they treat an existing entry for the same setting differently:
ADD SETTINGS variable = value ...first drops any existing entry forvariableand then inserts the new one. It therefore replaces the value together with all constraints of that setting. Any previously definedMIN,MAX, or writability (READONLY/WRITABLE/CONST/CHANGEABLE_IN_READONLY) forvariablethat you do not repeat is discarded.MODIFY SETTINGS variable = value ...merges field by field: it overrides only the fields you actually specify (the value, orMIN, orMAX, or the writability) and keeps the other fields of that setting as they were.
Examples
Create a profile to use in the examples below:MODIFY SETTINGS
Add or change a single setting while keeping the others:MODIFY merges field by field, changing only the value of a setting keeps its existing constraints:
ADD SETTINGS
Add a setting (also keeping the others), redefining it completely if it already exists:MODIFY, re-running ADD with only a value drops the previously defined constraints for that setting: