ClickHouse integration

ClickHouse analytics in plain English.

ClickHouse is built to answer questions over very large event tables, but only for people who can write its SQL. Connect it to InsightLab and anyone on the team can ask in plain language and get a table or chart back.

Example questions

Product questions, and the ClickHouse SQL behind them.

ClickHouse SQL leans on functions you won’t find in other databases. These three questions about product usage show the kind of query each becomes.

Illustrative examples. The SQL below was written by hand against a sample schema (a single wide events table) to show the ClickHouse dialect. It is not output captured from InsightLab, and your own tables and columns will differ.

  1. “How many users were active each month this year, and how many of them made a purchase?”

    toStartOfMonth buckets events by month. uniq returns an approximate count of distinct users, the usual choice on large tables (uniqExact is the exact version), and uniqIf applies a condition inside the aggregate.

    Illustrative ClickHouse SQL on a sample schema
    SELECT toStartOfMonth(event_time)               AS month,
           uniq(user_id)                            AS active_users,
           uniqIf(user_id, event_name = 'purchase') AS purchasers
    FROM events
    WHERE toYear(event_time) = toYear(now())
    GROUP BY month
    ORDER BY month;
  2. “What share of events were errors on each of the last 14 days?”

    countIf counts only the rows that match a condition, so the error share comes from a single scan. Dividing two integers in ClickHouse gives a fraction, not a rounded-down whole number.

    Illustrative ClickHouse SQL on a sample schema
    SELECT toDate(event_time)            AS day,
           count()                       AS events,
           countIf(event_name = 'error') AS errors,
           round(100 * countIf(event_name = 'error') / count(), 2) AS error_pct
    FROM events
    WHERE event_time >= now() - INTERVAL 14 DAY
    GROUP BY day
    ORDER BY day;
  3. “Which ten countries had the most checkouts in the last 7 days, and how slow were the slowest 5%?”

    quantile(0.95) is a parametric aggregate: the level goes in the first pair of brackets and the column in the second. Like uniq, it returns an estimate by default.

    Illustrative ClickHouse SQL on a sample schema
    SELECT country,
           count()                     AS checkouts,
           quantile(0.95)(duration_ms) AS p95_duration_ms
    FROM events
    WHERE event_name = 'checkout'
      AND event_time >= now() - INTERVAL 7 DAY
    GROUP BY country
    ORDER BY checkouts DESC
    LIMIT 10;
About ClickHouse

What’s distinctive about asking questions of ClickHouse.

ClickHouse is a column-oriented database built for analytics. It stores each column separately, so a query that touches three columns of a very wide table reads only those three. That design suits event and log data such as page views, product events, transactions and sensor readings, often in tables with billions of rows.

The data model differs from an application database. Instead of many normalized tables joined together, ClickHouse setups usually favor a few wide tables, with much of the meaning packed into event names and properties. Knowing that a “signup” is the event called account_created is the hard part. That is the kind of internal term you can define in InsightLab, alongside reviewed question-and-SQL examples.

The SQL is its own as well. Time bucketing uses functions such as toStartOfMonth, conditional aggregates take an If suffix, and distinct counts are often approximate by design. None of it is difficult, but it is unfamiliar to people who learned SQL on another database, which is a good reason to let them ask in plain language.

From question to routine

From a one-off question to a recurring view.

Event data is most useful when the same few numbers are watched over time and questioned when they move.

Drill into a change

When a daily number moves, ask a follow-up question in the same conversation to explore the result further.

Dashboards you can refresh

Save charts from conversations to a dashboard, and refresh the underlying queries when you need updated numbers.

Available to AI agents over MCP

Configured data sources can be exposed as tools for MCP-compatible AI agents.

FAQ

Questions about InsightLab and ClickHouse.

Do I need to learn ClickHouse SQL to use InsightLab with it?

No. Ask a business question in plain language and InsightLab builds the database query for you, then returns the result as a table or chart.

Does InsightLab replace ClickHouse?

No. ClickHouse remains your database. InsightLab connects to it so that people can ask questions in plain language and get tables, charts and dashboards from the data it holds.

Can we keep watching the same ClickHouse metrics over time?

Yes. Save charts from a conversation to a dashboard and refresh the underlying queries when you need updated numbers. Use chat to investigate when something changes.

Can our own event names and metrics be explained to InsightLab?

Yes. You can define internal terms and add reviewed question-and-SQL examples, and InsightLab uses your team’s definitions when it builds queries.

See it answer your team’s questions.

Tell us what your team wants to answer and which sources you use. We’ll walk through the product with you.

Request a demo