## Description `optimize_aggregation_in_order` is not enabled by default because it is often slower than the default hash aggregation. The reason is structural: for a multi-stream read the whole aggregation is funneled through a single `FinishAggregatingInOrderTransform`, so it runs on ~2–6 cores regardless of `max_threads` and is 8–16× slower than the defau
Closes: https://github.com/ClickHouse/ClickHouse/issues/109117 Implements per-authentication-method grant limits, the first part of the linked issue: ```sql ALTER USER vasya ADD IDENTIFIED WITH password BY 'WYmdFyas8PftrHbHQQo8' VALID UNTIL '2026-12-31' GRANTS (SELECT ON db.table) ``` When a user logs in with such a method, the access rights of the session a
We support `VALID UNTIL` for users and credentials. This adds `VALID FOR <interval>` as a convenience shorthand. Instead of an absolute date and time, `VALID FOR` accepts an interval, and the expiration deadline is computed as the current time plus that interval at the moment the query is executed. The result is stored in the `VALID UNTIL` form, so `SHOW CRE
Prototype changes to the Web UI (`programs/server/play.html`) to test and showcase the framing formats feature. This is a draft for experimentation and review of the client-side experience, not intended to merge as-is. It builds on the framing-formats server work in #110127 (this branch is based on that PR, so the diff includes those commits until it merges
<!-- Related: https://github.com/ClickHouse/ClickHouse/issues/107951 --> ### Changelog category (leave one): - Bug Fix (user-visible misbehavior in an official stable release) ### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELO
Resubmission of https://github.com/ClickHouse/ClickHouse/pull/104089 by Roman Vasin (@rvasin) into a branch of the main repository, with the review feedback from @Algunenano addressed. The original pull request is closed as superseded. Related: https://github.com/ClickHouse/ClickHouse/pull/104089 Related: https://github.com/ClickHouse/ClickHouse/pull/102801
Investigation for https://github.com/ClickHouse/ClickHouse/issues/99920 This is a draft PR with diagnostic assertions to help find a COW violation bug where columns stored in `HashJoin` have their `allocatedBytes()` change because internal sub-columns are modified by someone who treats immutable columns as mutable. ## What was found The bug manifests as `dat
### Changelog category (leave one): - New Feature ### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELOG.md): Support `SIMILAR TO` pattern matching predicate ### Documentation entry for user-facing changes - [ x ] Documentation i
<!-- Linked issues and pull requests. Use full GitHub URLs, one relationship per line; delete the lines you don't need. Closes: https://github.com/ClickHouse/ClickHouse/issues/106460 (auto-closes the issue when this PR is merged into the default branch) Related: https://github.com/ClickHouse/ClickHouse/pull/99543 --> Closes: https://github.com/ClickHouse/Cli
importance 10@groeneaiopenpr-bugfixcan be testedv26.5-must-backportOriginal evidence ↗
One fine day ... Requires ~https://github.com/ClickHouse/ClickHouse/pull/80363~ https://github.com/ClickHouse/ClickHouse/pull/109999 first. Removes the CatBoost integration: the `catboostEvaluate` function, the `system.models` table, the `SYSTEM RELOAD MODEL(S)` queries and the matching `SYSTEM RELOAD MODEL` privilege, together with their documentation, test
This patch adds a third mode to the S3Queue engine: `exclusive` mode turns off all file tracking and synchronization in ZooKeeper. S3 file processing will be tracked only locally via in-memory structures of this ClickHouse server process. This mode is meant to support high-throughput, high-volume ingestion scenarios. In our particular case, we have a minio i
<!-- Linked issues and pull requests. Use full GitHub URLs, one relationship per line; delete the lines you don't need. Closes: https://github.com/ClickHouse/ClickHouse/issues/NNNNN (auto-closes the issue when this PR is merged into the default branch) Related: https://github.com/ClickHouse/ClickHouse/pull/NNNNN --> ### Changelog category (leave one): - New
The parser accepted the modifiers of a column declaration in one fixed order only, so `COMMENT` had to be written before `CODEC`, `STATISTICS`, `TTL` and per-column `SETTINGS`: ```sql CREATE TABLE t (x UInt64 CODEC(ZSTD) COMMENT 'text') ENGINE = Memory; -- Code: 62. DB::Exception: Syntax error: failed at position 38 (COMMENT). -- Expected one of: STATISTICS,
Reapply #110760, reverted in #112935, together with a fix for the bug that motivated the revert. Related: https://github.com/ClickHouse/ClickHouse/pull/110760 Related: https://github.com/ClickHouse/ClickHouse/pull/112935 Related: https://github.com/ClickHouse/ClickHouse/issues/84085 ### Why it was reverted, and why the bug is not in the reverted change Every
### Describe the bug Seems not related to https://github.com/ClickHouse/ClickHouse/issues/102037 Reading a persistent DeltaLake (or Iceberg) table through a code path that does **not** call `updateExternalDynamicMetadataIfExists()` reaches `IDataLakeMetadata::iterate()` with a storage snapshot whose `datalake_table_state` is empty. `iterate()` treats this as
## Summary ClickHouse needs a first-class way to maintain **derived, query-specific data structures** next to a source table and use them **transparently** during planning — without making those structures a second system of record, and without forcing applications to query a side table. **Query Acceleration** is that framework: 1. User creates an **accelera
### Company or project name _No response_ ### Describe the unexpected behaviour ClickHouse runs CTE twice if we select from a view based on a query with MATERIALIZED CTE. ### Which ClickHouse versions are affected? Latest (26.7) ### How to reproduce https://fiddle.clickhouse.com/eb4a0c4a-7efa-4554-a3a6-67c964162b15 ```sql -- 1. Create a sample table CREATE T
### Changelog category (leave one): - Experimental Feature ### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELOG.md): Supports Paimon min-max index pushdown by setting `use_paimon_minmax_index_pruning=1` ### Documentation entry
importance 9@JiaQiTang98closedsubmodule changedcan be testedpr-experimentalOriginal evidence ↗
`StorageSQLite::read` used `LiteralEscapingStyle::Regular`, which escapes single quotes as `\'`. SQLite does not recognise backslash escapes; its only valid string escape is `''`. A pushed-down predicate like `WHERE col = 'it\'s'` causes SQLite to parse `'it\'` as a closed string and `s'` as a stray token — a SQL syntax error or injection vector. Switching t
A framing format multiplexes different response parts of the query in a single stream: chunks of data, totals and extremes, progress packets, profile events (metrics), and server logs — everything that the native protocol supports. This allows rich data exchange in the HTTP protocol. Framing formats are independent of output formats: they encapsulate bytes p
### Changelog category (leave one): - Documentation (changelog entry is not required) ## What The `h3GetOriginIndexFromUnidirectionalEdge` / `h3GetDestinationIndexFromUnidirectionalEdge` examples used directed edge `1248204388774707197`, which fails `h3UnidirectionalEdgeIsValid` and raises `INCORRECT_DATA` instead of returning the documented indexes. ## Fix
importance 9@Bartok9closedpr-documentationmanual approvecan be testedpr-synced-to-cloudOriginal evidence ↗
<!-- Related: https://github.com/ClickHouse/ClickHouse/pull/109454 Related: https://github.com/ClickHouse/ClickHouse/issues/109216 --> `WITH FILL FROM`/`TO` values are converted to a type wide enough for the arithmetic - `Int64` for every integer column type - while the generated values are written into a column of the column's own type, which truncates what
<!-- Linked issues and pull requests. Use full GitHub URLs, one relationship per line; delete the lines you don't need. Closes: https://github.com/ClickHouse/ClickHouse/issues/NNNNN (auto-closes the issue when this PR is merged into the default branch) Related: https://github.com/ClickHouse/ClickHouse/pull/NNNNN --> ### Changelog category (leave one): - New
A mutation that does not rewrite the whole part (the usual case for a `Wide` part: `ALTER UPDATE` of a single column, `RENAME COLUMN`, `DROP COLUMN`) only hardlinks the source part's files and copies its in-memory minmax index into the new part. That is enough for the partition-key columns, whose minmax files the source part always has on disk, but not for `
Closes: https://github.com/ClickHouse/ClickHouse/issues/87327 Related: https://github.com/ClickHouse/rust_vendor/pull/74 ### Changelog category (leave one): - New Feature ### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELOG.md)
#108556 made the SQL examples embedded in `system.documentation` runnable, but nothing runs them, so they go stale again as soon as behaviour changes: since then a steady stream of one-off fixes has been needed (#109421, #109965, #110459, #112287, ...). This adds a runner and a CI job that execute every one of them, and brings the examples and their document
### Changelog category (leave one): - New Feature ### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELOG.md): S3 tables engine catalog for datalakes. Same as https://github.com/ClickHouse/ClickHouse/pull/103220, but with working
Queries with a `JOIN` read the non-leftmost side in full on every replica, which can make parallel replicas slower than a plain single-node execution. This adds a kill switch so such queries can be excluded from parallel replicas without disabling parallel replicas altogether. New setting `parallel_replicas_for_queries_with_multiple_tables` (default `true`,
Introduces `GlobAST`, a regex-free glob parser, and wires it into the file and object-storage listing paths. It is **off by default** (the experimental `use_glob_ast_parser` setting), so `master` behavior is unchanged — the goal is to land the parser and all the wiring now so that enabling it later is a one-setting switch. The legacy engine builds a regex (`
`ClientBase` eagerly called `isStdinNotEmptyAndValid` to check for trailing stdin data on every `INSERT`. That helper calls `!std_in.eof()`, which performs a blocking `read(0, ...)`. When stdin is a pipe that is open but has no data and no `EOF` (common in CI, Docker, stress tests, and `--queries-file` invocations), the read blocks indefinitely and the clien
_Important: This issue was automatically generated and is used by CI for matching failures. DO NOT modify the body content. DO NOT remove labels._ Test name: Logical error: Can't extract iceberg table state from storage snapshot for table location A (STID: 2606-4a47) CI report: [Stress test (amd_msan)](https://s3.amazonaws.com/clickhouse-test-reports/json.ht
When a Tuple column has an element stored with sparse serialization, re-running an INSERT … SELECT that is caught by block deduplication throws LOGICAL_ERROR (code 49) instead of being a silent no-op. Repro (tested in 26.4.1): ``` CREATE TABLE sparse_tuple_src ( id UInt64, body Tuple(key UInt64, flag Bool) ) ENGINE = MergeTree ORDER BY id; CREATE TABLE spars
_Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment._ ### Describe what's wrong After this PR, `countIfOrNull(number, NULL)` returns `Nullable(UInt64)` `NULL` where it returned `UInt64` `0`; `uniqIfOrNull(number, NULL)` likewise flips `0` -> `NULL`; `sumIfResample(0, 2, 1)(number, NULL, number % 2)` returns
**Company or project name** Prefer not to specify **Describe what's wrong** `RENAME DATABASE` query doesn't seem to be working correctly with materialized view statements. After renaming a database with `RENAME DATABASE old_name TO new_name` query, the materialized views would still reference tables with the `old_name` as could be seen with `SHOW CREATE new_
### Company or project name _No response_ ### Describe the unexpected behaviour As of now, it is impossible to connect to a PostgreSQL with enforced SSL connections, with or without verifying the certificates ### How to reproduce Setup a PostgreSQL with required SSL (e.g. with zalando postres operator) Try to create a MaterializedPostgreSQL Database Connecti
### Company or project name _No response_ ### Use case Retries after network connection errors are really complex in distributed systems. There are many operations that are quite risky to be retried such as `EXCHANGE TABLE` and we do not have easy way to check that previous operation succeeded or not for example, when disconnect was result of completely disa
### Changelog category (leave one): - Backward Incompatible Change ### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELOG.md): Lightweight `UPDATE` patch parts now use a new v2 on-disk format sorted by (`sorting_key..., _block_nu
`aiRedact` detects and redacts PII in text using an LLM provider. For example: SELECT aiRedact('Contact John Doe at john@doe.org', ['name', 'email']) -- 'Contact [REDACTED] at [REDACTED]' Pass an empty `categories` array to fall back to a default set of common categories (name, email, phone number, address, credit card, IP address). The redaction token defau
importance 8@davidmenggxopenpr-featuremanual approvecan be testedOriginal evidence ↗
Closes: https://github.com/ClickHouse/ClickHouse/issues/58726 A `MaterializedPostgreSQL` database or table created with `ON CLUSTER` gets the *same* ClickHouse UUID on every replica, because the UUID is generated once on the initiator and shipped in the DDL. With `materialized_postgresql_use_unique_replication_consumer_identifier = 1` the replication slot na
<!-- Closes: https://github.com/ClickHouse/ClickHouse/issues/111320 --> ### Changelog category (leave one): - Bug Fix (user-visible misbehavior in an official stable release) ### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELOG
importance 8@groeneaiopenpr-bugfixmanual approvecan be testedOriginal evidence ↗
Caused by: https://github.com/ClickHouse/ClickHouse/pull/57201 Related: https://github.com/ClickHouse/ClickHouse/pull/100419 `collapseDemangledNames` replaced a stack frame's function name with `?` whenever the frame's source location was a file in a directory ending in `functional`. The intent was to hide `std::function` plumbing frames, whose demangled nam
<!-- Related: https://github.com/ClickHouse/ClickHouse/issues/61742 --> ### Changelog category (leave one): - Experimental Feature ### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELOG.md): Reimplemented the experimental KQL (Ku
Related: https://github.com/ClickHouse/ClickHouse/pull/109000 `MergeTreeSink::onStart` and `ReplicatedMergeTreeSink::onStart` perform the `parts_to_throw_insert` / `parts_to_delay_insert` check, and `onStart` is the only place where an `INSERT` may be rejected with `TOO_MANY_PARTS` - rejecting a query that has already written a part is not acceptable, as the
The `AST fuzzer (amd_debug)` crashed the server with `Integer divide by zero` on ```sql SELECT id FROM merge(currentDatabase(), '^t$') ORDER BY id DESC SETTINGS max_streams_to_max_threads_ratio = 1073741824, max_threads = 4 ``` The planner computes `max_streams = max_threads * max_streams_to_max_threads_ratio = 2^32`, which passes the existing overflow check
_Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment._ _Retrospective finding from a historical scan of [PR #79488](https://github.com/ClickHouse/ClickHouse/pull/79488) (merged 2025-04-25). Confirmed on current codebase — close with a note if already fixed._ ### Describe what's wrong RENAME DATABASE to a long
We have basic infrastructure for `QueryPlan` serialization and deserialization: https://github.com/ClickHouse/clickhouse/blob/master/src/Processors/QueryPlan/QueryPlan.h#L101-L104. It's implemented for multiple steps, for example `GROUP BY`: https://github.com/ClickHouse/clickhouse/blob/master/src/Processors/QueryPlan/AggregatingStep.cpp#L945-L1105. However
## Describe the unexpected behaviour When column statistics are enabled (`use_statistics = 1`, the default), the join-order optimizer estimates relation cardinalities over **all** active parts of a MergeTree table, ignoring partition/PK pruning that execution will later perform. A query whose `WHERE` prunes to a 1,000-row partition of a 5,001,000-row table i
_Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment._ ### Describe what's wrong Reading a MySQL table that has a NULLABLE spatial column (`LINESTRING`/`POLYGON`/`MULTILINESTRING`/`MULTIPOLYGON`/generic `GEOMETRY`) via the `mysql()` table function, the `MySQL` table engine, or the `MySQL` database engine thro