Home / Companies / ClickHouse / Blog / Post Details
Content Deep Dive

JIT in ClickHouse

Blog post from ClickHouse

Post Details
Company
Date Published
Author
Maksim Kita
Word Count
5,783
Language
English
Hacker News Points
20
Summary

JIT (Just-in-time) compilation is a technique used to generate machine code and execute it at runtime, improving performance by compiling dynamic configurations into static ones. In ClickHouse, JIT compilation is used for expression evaluation, aggregate functions, and ORDER BY comparators. The compiler uses LLVM infrastructure to achieve this, with various optimizations and techniques such as fusing multiple aggregate functions into one, reducing virtual function calls, and using SIMD instructions. While JIT compilation has its costs, including compilation time, memory, and maintenance, it can greatly improve performance in many cases, particularly for expressions, aggregations, and ORDER BY comparators, with improvements ranging from 1.15 to 3 times or more depending on the specific use case.