Real-Time Market AnalyticsClickHouse Workshops

05 Ask the AI to fix a query

Hand the full-scan query from module 04 to the ClickHouse Assistant and watch it diagnose the missing sort key, then offer a skip index and a projection with ready-to-run SQL.

ClickHouse Cloud has a built-in co-pilot, the ClickHouse Assistant, right in the SQL Console. It knows ClickHouse functions and best practices — not generic SQL.

SQL Console with a count query in the editor and the Assistant sparkle icon in the top-right corner

Open the SQL Console and click the sparkle icon in the top-right corner to open the Assistant. Your query stays in the editor while you chat.

  1. Open the Assistant in the SQL Console.

  2. Paste the non-optimized query from module 4.7:

    SELECT count() FROM forex WHERE bid > 1.5;
  3. Ask it, in plain English: "Why does this query scan the whole table, and how can I make it faster?"

  4. Read its answer — it diagnoses why the query scans everything (bid isn't in the sort key), then proposes concrete ClickHouse fixes with ready-to-run SQL: a lightweight minmax skip index on bid, or a projection that keeps a copy of the data pre-sorted by bid.

What to notice

The Assistant explains that bid isn't in the sort key, so nothing can be pruned — then offers ClickHouse-specific fixes, each with copy-paste ALTER TABLE SQL and an "Open in editor" button. Not generic advice: it reaches for the exact features ClickHouse gives you.

ClickHouse Assistant panel suggesting a minmax skip index and a projection on the bid column, each with ready-to-run ALTER TABLE SQL

Track your progress?

Optional. We email a link to confirm your address; progress records once you open it.

Partners: use your work email to unlock partner-exclusive workshops.