Skip to main content
Skip to main content
Edit this page

Performance and Optimizations

This section contains tips and best practices for improving performance with ClickHouse. We recommend users read Core Concepts as a precursor to this section, which covers the main concepts required to improve performance.

TopicDescription
Query optimization guideStart here for query optimization fundamentals, covering common scenarios and performance techniques to improve query execution speed.
Primary indexes advanced guideDeep dive into ClickHouse's unique sparse primary indexing system, how it differs from traditional databases, and best practices for optimal indexing strategies.
Query parallelismLearn how ClickHouse parallelizes query execution using processing lanes and max_threads settings, including how to inspect and optimize parallel execution.
Partitioning keyMaster partition key selection to dramatically improve query performance by enabling efficient data segment pruning and avoiding common partitioning pitfalls.
Data skipping indexesApply secondary indexes strategically to skip irrelevant data blocks and accelerate filtered queries on non-primary key columns.
PREWHERE optimizationUnderstand how PREWHERE automatically reduces I/O by filtering data before reading unnecessary columns, plus how to monitor its effectiveness.
Bulk insertsMaximize ingestion throughput and reduce resource overhead by batching data insertions effectively.
Asynchronous insertsImprove insert performance by leveraging server-side batching to reduce client-side complexity and increase throughput for high-frequency insertions.
Avoid mutationsDesign append-only workflows that eliminate costly UPDATE and DELETE operations while maintaining data accuracy and performance.
Avoid nullable columnsReduce storage overhead and improve query performance by using default values instead of nullable columns where possible.
Avoid OPTIMIZE FINALUnderstand when you should and should not use OPTIMIZE TABLE FINAL
AnalyzerLeverage ClickHouse's new query analyzer to identify performance bottlenecks and optimize query execution plans for better efficiency.
Query profilingUse the sampling query profiler to analyze query execution patterns, identify performance hot spots, and optimize resource usage.
Query cacheAccelerate frequently executed SELECT queries by enabling and configuring ClickHouse's built-in query result caching.
Testing hardwareRun ClickHouse performance benchmarks on any server without installation to evaluate hardware capabilities. (Not applicable to ClickHouse Cloud)