📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

UNSET



Reverts one or more system settings to their global or default levels and values. For more information about the setting levels, see Setting Levels. To show all the current settings, use SHOW SETTINGS.

See also: SET

Syntax

-- Unset one setting UNSET [ SESSION | GLOBAL ] <setting_name> -- Unset multiple settings UNSET [ SESSION | GLOBAL ] ( <setting_name>, <setting_name> ... )
ParameterDescription
SESSIONIf the setting has a global-level value, it removes the session-level override and reverts to the global setting. If the setting only has a session-level value, it reverts to the default setting.
GLOBALRemoves the global-level setting and reverts it to the default-level value.
Lake-Query VersionDescription
[-∞, v1.2.605)In default, UNSET <setting_name> is equal to UNSET GLOBAL <setting_name>.
[v1.2.605, +∞]In default, UNSET <setting_name> is equal to UNSET SESSION <setting_name>.

Examples

This example uses UNSET GLOBAL to remove the global-level setting for timezone, reverting it back to its default value and level:

SHOW SETTINGS LIKE 'timezone'; ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ valuedefaultrange │ level │ description │ type │ ├──────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ UTC │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ DEFAULT │ Sets the timezone. │ String │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -- Sets timezone to 'Asia/Shanghai' at global level SET GLOBAL timezone = 'Asia/Shanghai'; SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼───────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼────────┼────────────────────┼────────┤ │ timezone │ Asia/Shanghai │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ GLOBAL │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -- Removes the global-level setting for timezone UNSET GLOBAL timezone; SHOW SETTINGS LIKE 'timezone'; ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ valuedefaultrange │ level │ description │ type │ ├──────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ UTC │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ DEFAULT │ Sets the timezone. │ String │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

This example uses UNSET SESSION to remove the session-level setting for timezone, reverting it back to the global-level setting:

SHOW SETTINGS LIKE 'timezone'; ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ valuedefaultrange │ level │ description │ type │ ├──────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ UTC │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ DEFAULT │ Sets the timezone. │ String │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -- Sets timezone to 'Asia/Shanghai' at global level SET GLOBAL timezone = 'Asia/Shanghai'; SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼───────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼────────┼────────────────────┼────────┤ │ timezone │ Asia/Shanghai │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ GLOBAL │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -- Set timezone to 'America/Santiago' in current session SET timezone = 'America/Santiago'; SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ valuedefaultrange │ level │ description │ type │ ├──────────┼──────────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ America/Santiago │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ SESSION │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ UNSET SESSION timezone; SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼───────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼────────┼────────────────────┼────────┤ │ timezone │ Asia/Shanghai │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ GLOBAL │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

This example uses UNSET SESSION to remove the session-level setting for timezone, reverting it back to the session-level setting:

SHOW SETTINGS LIKE 'timezone'; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ valuedefaultrange │ level │ description │ type │ ├──────────┼───────────────┼─────────┼─────────────────────────────────────────────────────────────────────┼────────┼────────────────────┼────────┤ │ timezone │ Asia/Shanghai │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ GLOBAL │ Sets the timezone. │ String │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ UNSET timezone; SHOW SETTINGS LIKE 'timezone'; ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ name │ value │ default │ range │ level │ description │ type │ ├──────────┼────────┼─────────┼─────────────────────────────────────────────────────────────────────┼─────────┼────────────────────┼────────┤ │ timezone │ UTC │ UTC │ ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa... │ DEFAULT │ Sets the timezone. │ String │ └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Was this page helpful?