Profile-Guided Optimization (PGO) is a compiler optimization technique where a program is optimized based on the runtime profile. According to the tests, PGO helps with achieving better performance for ClickHouse. According to the tests, we see improvements up to 15% in QPS on the ClickBench test suite. The more detailed results are available here. The performance benefits depend on your typical workload - you can get better or worse results. More information about PGO in ClickHouse you can read in the corresponding GitHub issue.Documentation Index
Fetch the complete documentation index at: https://private-7c7dfe99-page-updates.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
How to build ClickHouse with PGO?
There are two major kinds of PGO: Instrumentation and Sampling (also known as AutoFDO). In this guide is described the Instrumentation PGO with ClickHouse.- Build ClickHouse in Instrumented mode. In Clang it can be done via passing
-fprofile-generateoption toCXXFLAGS. - Run instrumented ClickHouse on a sample workload. Here you need to use your usual workload. One of the approaches could be using ClickBench as a sample workload. ClickHouse in the instrumentation mode could work slowly so be ready for that and do not run instrumented ClickHouse in performance-critical environments.
- Recompile ClickHouse once again with
-fprofile-usecompiler flags and profiles that are collected from the previous step.