> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-trino-dialect.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query optimization

> Learn how to diagnose slow ClickHouse queries, isolate bottlenecks, and select targeted optimizations

These guides provide a workflow for investigating and improving slow queries in ClickHouse. Identify a recurring slow query, isolate its bottleneck, choose a targeted optimization, and compare the result with a repeatable baseline.

<h2 id="choose-where-to-start">
  Choose where to start
</h2>

The first three guides form an end-to-end workflow, but you can also enter at the stage that matches what you already know.

<CardGroup cols={1}>
  <Card title="Diagnose slow queries" icon="magnifying-glass" href="/guides/clickhouse/performance-and-monitoring/diagnose-slow-queries">
    Start here when you need to identify a recurring slow-query pattern. Use local or cluster-wide query history to choose a representative run, inspect its resource usage, and form an initial hypothesis.
  </Card>

  <Card title="Isolate query bottlenecks" icon="layer-group" href="/guides/clickhouse/performance-and-monitoring/isolate-query-bottlenecks">
    Start here when you have a slow query but do not yet know which operations dominate its performance. Compare progressively simpler forms of the query under controlled conditions.
  </Card>

  <Card title="Choose an optimization approach" icon="sliders" href="/guides/clickhouse/performance-and-monitoring/optimization-approaches">
    Start here when you have evidence about the bottleneck and need to choose a targeted change. Compare approaches for reducing the data that is read, aligning the data layout with your queries, or precomputing repeatable work.
  </Card>
</CardGroup>

<h2 id="example">
  Example
</h2>

<Card title="Worked optimization example" icon="flask" href="/guides/clickhouse/performance-and-monitoring/query-optimization-example">
  Start with workload queries against the NYC Taxi dataset, then apply schema and ordering-key changes, measuring each stage against the same baseline.
</Card>
