[CH]Optimize and filter conditions by move equals ahead
- Dominant language
- Scala
- Stars
- 1.6k
- Forks
- 657
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 80
Description
### Description
when do query contains multiple `and` conditions in where , just like `select count(1) from test_tbl where cast(b as string) != '' and a = 1`, we can simply move the equals conditions ahead to improve the performance, the sql can be executed as `select count(1) from test_tbl where a = 1 and cast(b as string) != ''`, below it is the performance comparsion of the two sql


Contributor guide
Research direction
No file, test, or entry point is identified in the issue. Start by locating the ClickHouse condition-processing path that handles multiple WHERE predicates, then inspect how equality and cast conditions are ordered. Done means equivalent conditions are executed with equality predicates first and the reported query-performance improvement is validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clickhouse, sql
- Domain
- backend, databases, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100