Skip to content

Add SYSTEM UNLOAD DICTIONARY / DICTIONARIES commands - #96064

Closed
xiaohuanlin wants to merge 3 commits into
ClickHouse:masterfrom
xiaohuanlin:feature/system-unload-dictionary
Closed

xiaohuanlin wants to merge 3 commits into
ClickHouse:masterfrom
xiaohuanlin:feature/system-unload-dictionary

Conversation

@xiaohuanlin

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Add SYSTEM UNLOAD DICTIONARY and SYSTEM UNLOAD DICTIONARIES commands to release dictionary memory without dropping the dictionary definition. Dictionaries will be reloaded lazily on next access.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

New SQL commands:

  • SYSTEM UNLOAD DICTIONARY [db.]name — unloads a specific dictionary from memory, releasing its data. The dictionary will be reloaded automatically on next query that accesses it.
  • SYSTEM UNLOAD DICTIONARIES — unloads all loaded dictionaries.

Motivation: When dictionaries consume significant memory but are only needed occasionally, users can free memory without dropping and recreating the dictionary. This was previously not possible — the only options were DROP DICTIONARY (loses definition) or waiting for server restart.

Reuses SYSTEM_RELOAD_DICTIONARY access rights, so users with reload permissions can also unload.

Example:

-- Unload a specific dictionary
SYSTEM UNLOAD DICTIONARY my_database.my_dict;

-- Unload all dictionaries
SYSTEM UNLOAD DICTIONARIES;

-- Dictionary reloads automatically on next access
SELECT dictGet('my_database.my_dict', 'value', toUInt64(1));

Closes #93776

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Feb 5, 2026
@clickhouse-gh

clickhouse-gh Bot commented Feb 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bdfd7c9]

Summary: ❌

job_name test_name status info comment
Stress test (amd_tsan) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-2da1) FAIL cidb, issue
AST fuzzer (amd_tsan) failure
Logical error: Cannot find variant type A in result Variant type B during execution of C (STID: 4827-671c) FAIL cidb
BuzzHouse (amd_debug) failure
Logical error: Part A from table B remains in ZooKeeper after DROP_RANGE C (STID: 4202-575d) FAIL cidb, issue
Finish Workflow failure
python3 ./ci/jobs/scripts/workflow_hooks/feature_docs.py failure

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Feb 5, 2026
Implement SYSTEM UNLOAD DICTIONARY and SYSTEM UNLOAD DICTIONARIES
to release dictionary memory and reset to lazy-load state.
Reuses SYSTEM_RELOAD_DICTIONARY access rights for consistency.

Closes ClickHouse#93776
After rebase, resolveDictionaryName now takes (string, string) instead of
(string, ContextPtr). Update unloadDictionary to use getCurrentDatabase().
@xiaohuanlin
xiaohuanlin force-pushed the feature/system-unload-dictionary branch from f77dbd8 to bdfd7c9 Compare February 5, 2026 21:29
@Manerone Manerone self-assigned this Jul 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Dear @Manerone, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-feature Pull request with new product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An option to unload dictionary

3 participants