ClickHouse / ClickHouse/ClickHouse

Performance degradation with trivial query

Open
#76,334 0 comments 0 reactions 0 assignees View on GitHub
comp-query-optimizer performance unexpected behaviour
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

### Company or project name

ClickHouse employee 😄

### Describe the unexpected behaviour

A modified TPC-H query is taking much longer in ClickHouse v25.2 compared to v24.10

### How to reproduce

Load a heavy TPC-H dataset into ClickHouse both v24.10 and v25.2 (the current master), then run the following query:

```sql
SELECT 1 FROM supplier, revenue0 WHERE (s_suppkey = supplier_no) AND total_revenue = (SELECT max(1) FROM revenue0 HAVING 0);
```
v25.2 takes much longer and reads more rows because `HAVING 0` is not optimized away. The same happens with `QUALIFY` clause, but not `WHERE`.

### Expected behavior

Both runs should be in the same amount of time.

### Error message and/or stacktrace

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.