Skip to content
Back to skills

Clickhouse Knowledge Patch

ASecurity

ClickHouse

  • 25 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 5, 2026
ai-agentsgosqlexpressgcpazureapidatabasesecurity

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill clickhouse-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clickhouse Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clickhouse Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-clickhouse-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-clickhouse-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: clickhouse-knowledge-patch
description: ClickHouse
version: "26.11.6.4"
license: MIT
metadata:
  author: Nevaberry
---


# ClickHouse compatibility and feature guidance

Load this skill when writing or reviewing ClickHouse SQL, preparing an upgrade,
configuring access and storage, or investigating changed query behavior.
Use the references for complete conditions, examples, and batch attributions.
Version-specific changes to defaults and feature tiers remain attributed there.

## Reference index

| Reference | Topics |
| --- | --- |
| [Upgrades, security, and settings](references/upgrades-security-and-settings.md) | Upgrade preparation, removed features, credentials, grants, TLS, profiles, feature tiers |
| [Tables, indexes, and views](references/tables-indexes-and-views.md) | Schemas, inserts, parts, mutations, TTL, text indexes, projections, refreshable views |
| [Query language and functions](references/query-language-and-functions.md) | SQL syntax, joins, parallel replicas, plans, aggregation, JSON, types, conversions |
| [External data and formats](references/external-data-and-formats.md) | Iceberg, catalogs, Delta Lake, Paimon, Hudi, object storage, external databases, serialization |
| [Operations, integrations, and tooling](references/operations-integrations-and-tooling.md) | Clients, local sessions, backups, Keeper, queues, dictionaries, workloads, HTTP, logs, PromQL |
| [Vectors, geometry, and classifiers](references/vectors-geometry-and-classifiers.md) | AI functions, embeddings, QBit, vector indexes, dictionary classifiers, geometry |

## Upgrade blockers and removals

### Insert deduplication migration

To migrate from a legacy `insert_deduplication_version`, first run an intermediate
release with `compatible_double_hashes` for at least
`replicated_deduplication_window_seconds` on replicated tables (one hour by
default) and at least `non_replicated_deduplication_window` inserts on
non-replicated tables with a positive window. Before upgrading to 26.7, remove
the setting or set it to `new_unified_hash`: 26.7 uses the same hash for synchronous
and asynchronous inserts and refuses to start with `old_separate_hashes` or
`compatible_double_hashes`.

### Removed definitions and settings

- Drop experimental `WINDOW VIEW` definitions before upgrading so the server can
  parse its metadata at startup. `WATCH` and `windowID` are removed.
- Before upgrading, rewrite persisted expressions using `catboostEvaluate`,
  replace references to `system.models`, and drain queued
  `SYSTEM RELOAD MODEL(S) ON CLUSTER` commands. Revoke `SYSTEM RELOAD MODEL`
  from all users and roles, including Keeper-backed access storage, remove the
  grant from `users.xml`, and regenerate affected `BACKUP ... ACCESS` backups.
- The server ignores `resources` and `workload_classifiers` configuration
  sections and logs a warning. Migrate their definitions to `CREATE RESOURCE`
  and `CREATE WORKLOAD` before upgrading.
- `enable_analyzer` and `allow_experimental_analyzer` are obsolete; assignments
  of `0` are rejected. The analyzer stays active across all `compatibility` values.

### Formats shared with older servers

- During a rolling upgrade from before 26.8, keep `patch_parts_version = 'v1'`
  or pin `compatibility` to the earlier version until all replicas are upgraded.
  Lightweight `UPDATE` writes v2 patch parts by default; upgraded servers still
  read v1 parts.
- New text indexes default to `text_index_posting_list_codec = 'pfor'`.
  Servers older than 26.10 cannot read these parts; use an older `compatibility`
  pin during a rolling upgrade to keep writing uncompressed posting lists.
- `enable_hard_links` defaults to enabled for `plain_rewritable` disks. Set it
  to `0` before upgrading if servers older than 26.10 must keep reading the disk.
  Those versions cannot read it after the first hard link is created by a
  mutation, ALTER, FREEZE, or backup.
- Experimental distributed plan settings use an encoding incompatible with 26.10
  and older. Upgrade both ends of a serialized plan exchange to 26.11 or later.

### Persisted expressions and configuration

`toStartOfInterval`, `time_bucket`, and `date_bin` preserve the input type and
the scale of `DateTime64`. Set `to_start_of_interval_preserves_argument_type = 0`
for old expressions whose return type depends on the interval unit, including
existing partition or sorting keys.

`arrayFirst` and `arrayLast` with no match, and `arrayMin` and `arrayMax` on an
empty array, use the lowest member of the `Enum` type, including enums inside a
tuple or typed JSON path. Rebuild persisted keys, indexes, projections, and
`MATERIALIZED` or `DEFAULT` values computed with the previous behavior.

Set `max_distributed_connections` to at least 1 in queries, sessions, and profiles.
Before upgrading, correct zero values in user configuration and run
`SYSTEM FLUSH DISTRIBUTED` to drain old queued inserts that used zero: an affected
file blocks the files behind it.

## Credentials, permissions, and settings

### Server credentials and named collections

User SQL accessing S3 needs explicit or operator-provisioned credentials or
`NOSIGN`. Named collections default `use_environment_credentials` to `0`.
`allow_server_credentials_in_user_queries` is the new name for
`s3_allow_server_credentials_in_user_queries` and also controls whether user SQL
can use the server's Azure workload or managed identity. With the setting
disabled, supply an account name and key, a connection string, or a SAS token
for Azure. An explicit `extra_credentials(role_arn = ...)` can assume that role
with `s3_allow_server_credentials_in_user_queries = 0`.

Overriding a stored named collection key requires `SHOW NAMED COLLECTIONS SECRETS`
on the collection; adding new keys remains allowed. Before upgrading, remove a
stored table's `SETTINGS` or alias override of a `NOT OVERRIDABLE` key or make
that key overridable to prevent startup failure.

Kafka rejects file-based `librdkafka` settings such as `kafka.ssl_ca_location`
from SQL-created named collections. Move those collections into server
configuration or use inline PEM settings such as `kafka.ssl_ca_pem` for TLS material.

### Grants and constraints

`BACKUP` requires the destination source's `WRITE` grant; `RESTORE` and
`ENGINE = Backup` require its `READ` grant. An allowlisted `Disk(...)` destination
also requires `WRITE ON DISK` for backup or `READ ON DISK` for restore and reads.
`RESTORE ... ON CLUSTER` checks engine grants, including for materialized views'
inner tables.

`CREATE OR REPLACE` for users, roles, quotas, settings profiles, and row policies
requires the corresponding `DROP` privilege in addition to `CREATE`.
`GRANT CURRENT GRANTS ... WITH REPLACE OPTION` requires the issuing user to hold
the grant option for each privilege it revokes from the grantee.

Nested `SETTINGS` clauses respect user constraints: forbidden changes are dropped
and values are clamped to `MIN` and `MAX`; a violation in the outer query still
raises an error. Unknown names or uncastable values in nested clauses raise errors.

`allow_feature_tier` uses `0` for all tiers, `1` for private preview and above,
`2` for beta and production, and `3` for production only. Change an existing
production-only value from `2` to `3`.

## Inserts, indexes, and materialized views

Asynchronous inserts are enabled by default in 26.3 LTS. The server buffers data
and flushes it at a timeout, size threshold, or queued-insert threshold.
`max_insert_threads` defaults to `auto`; `max_insert_threads = 1` restores the
earlier default. With parallel writes, plain inserts and single-stream
`INSERT SELECT` preserve input order for `CollapsingMergeTree`,
`CoalescingMergeTree`, `GraphiteMergeTree`, and `ReplacingMergeTree` (including
replicated variants), and `EmbeddedRocksDB`, including through materialized views
or `Alias` tables. A `SELECT` with multiple input streams can still write in parallel.

Enable beta text indexes with `enable_full_text_index = 1` and specify a
tokenizer explicitly. Token search functions such as `hasAllTokens` can use them.
A filtered projection materializes rows satisfying its `WHERE`; the optimizer
can choose it when the query's `WHERE` implies the projection predicate.

```sql
ALTER TABLE events ADD PROJECTION positive_ids (SELECT id WHERE id > 0);
```

Use `REFRESH DEPENDS ON` without a timer on downstream refreshable materialized
views so upstream refreshes trigger the cascade. Use
`REFRESH EVERY 1 MINUTE APPEND INCREMENTAL` to append source rows committed since
the last refresh. Iceberg targets commit the cursor atomically with the snapshot,
providing exactly-once refresh. Renaming an incremental refresh source is rejected.

## Query planning and SQL

`EXPLAIN ANALYZE` executes the query and reports measured execution metrics.
Session-local hypothetical skip indexes can be evaluated with `EXPLAIN WHATIF`;
the estimator reads table data to build candidates in memory, and those reads
count against session limits and quotas.

```sql
CREATE HYPOTHETICAL INDEX town_set ON uk_price_paid (town) TYPE set(10) GRANULARITY 1;
EXPLAIN WHATIF SELECT count() FROM uk_price_paid WHERE town = 'LONDON';
```

`parallel_hash` is an obsolete alias of `hash`. With `hash_join_layout = 'auto'`,
the build is serial below `parallel_hash_join_threshold` and parallel at or above
it or when the right-hand row estimate is unknown. `max_bytes_before_external_join`
and `max_bytes_ratio_before_external_join` control hash-join spilling;
`max_rows_in_join` and `max_bytes_in_join` are hard caps. `grace_hash` requires a
nonzero spill threshold and is skipped during algorithm selection without one.

With `enable_materialized_cte = 1`, `AS MATERIALIZED` evaluates a CTE once and
shares its temporary result across references.

```sql
SET enable_materialized_cte = 1;
WITH sample AS MATERIALIZED (SELECT rand() AS n)
SELECT a.n, b.n FROM sample AS a CROSS JOIN sample AS b;
```

`INSERT ... RETURNING (SELECT ...)` streams a result over the inserted rows,
including generated values. Within that `SELECT`, omitting `FROM` or naming the
destination table reads the rows from this insert.

## JSON, data lakes, and AI functions

`JSON`, and standalone `Variant` and `Dynamic` columns, are production-ready.
The `JSONExtract` family accepts native `JSON` arguments. `SHARED` stores typed
JSON paths together in MergeTree parts while keeping each independently readable.

```sql
CREATE TABLE events (
    payload JSON(SHARED a UInt32, SHARED b String)
) ENGINE = MergeTree ORDER BY tuple();
```

Iceberg engines support experimental writes with
`allow_experimental_insert_into_iceberg = 1`; REST and Glue catalogs support
Iceberg writes and `DROP TABLE`. Dropping an `IcebergLocal` table leaves its files
in place. Delta Lake reads always use Delta Kernel; `allow_delta_kernel_rs` and
`allow_experimental_delta_kernel_rs` are obsolete. GCS tables relying on
`http_client = 'gcp_oauth'` and Azure blobs with leading `/` in their names are no
longer supported by Delta Lake reads.

AI functions and `ai_function_*` settings use the beta feature tier;
`allow_experimental_ai_functions` is obsolete. Calling a function requires its
function privilege and `NAMED COLLECTION` access to the selected credentials.
`ai_function_max_input_tokens_per_query`, `ai_function_max_output_tokens_per_query`,
and `ai_function_max_api_calls_per_query` default to `0` for unlimited usage.
Token limits are best-effort; the API-call cap is exact, with each distributed
server or fragment enforcing its own limits. Set `allow_ai_functions = 0` to disable them.

## Operational quick reference

Without `--path`, `clickhouse-local` keeps data between runs. Use `--tmp` for a
fresh directory removed on exit or separate `--path` directories for concurrent
persistent instances. `SYSTEM START LISTEN TCP` or `SYSTEM START LISTEN HTTP`
opens a listener in a local session; the corresponding `SYSTEM STOP LISTEN`
command closes it.

Set `log_query_plans = 1` to populate `system.query_log.query_plan` with the
executed plan and per-step runtime statistics as JSON. Query `system.connections`
for client connections, including idle sessions.

`max_execution_time` excludes workload admission waiting.
`workload_admission_timeout_ms` bounds that wait separately; its default `0`
allows an unbounded wait.

Files in this skill

  • SKILL.md10.1 KB
  • coverage.json487 B
  • references/external-data-and-formats.md5.9 KB
  • references/operations-integrations-and-tooling.md6.4 KB
  • references/query-language-and-functions.md6.5 KB
  • references/tables-indexes-and-views.md5 KB
  • references/upgrades-security-and-settings.md4.5 KB
  • references/vectors-geometry-and-classifiers.md4.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.