Run read-only ClickHouse queries

DevOpsPad sends each ClickHouse query over HTTP with readonly=1, max_result_rows=500, result_overflow_mode=break and max_execution_time=15. ClickHouse itself refuses INSERT, ALTER, CREATE, DROP and setting changes under readonly=1, so the editor cannot modify data.

Write normal ClickHouse SQL without a FORMAT clause. Results come back as JSONCompact, are trimmed to 500 rows and keep 64-bit integers exact.

Run a query

  1. Select the ClickHouse connection in the Explorer and choose a database in the selector.
  2. Click a table to open a tab with a SELECT … LIMIT 100 query, or click New query.
  3. Press ⌘ / Ctrl + Enter or click Run query.
SELECT
    toStartOfHour(event_time) AS hour,
    count() AS events,
    uniqExact(user_id) AS users
FROM events
WHERE event_time >= now() - INTERVAL 1 DAY
GROUP BY hour
ORDER BY hour;

The query runs against the database selected for that tab. Each tab keeps its own database scope.

Settings DevOpsPad sends

Setting Value Effect
readonly 1 Only read queries are allowed
max_result_rows 500 Result size cap
result_overflow_mode break Return a partial result instead of an error when the cap is hit
max_execution_time 15 ClickHouse stops the query after 15 seconds
default_format JSONCompact Response format the app parses

When the cap is hit, the footer reports that the result limit was reached. ClickHouse can return a few more rows than the cap because it stops at block boundaries; DevOpsPad keeps the first 500.

Inspect a table

Click the inspect button next to a table, or Structure in the tab toolbar:

  • Columns comes from DESCRIBE TABLE: name, type, default kind and expression, comment, codec and TTL expression.
  • Indexes lists data-skipping indexes from system.data_skipping_indices: name, type, expression and granularity. The primary key and sorting key appear in the DDL, not here.
  • DDL shows SHOW CREATE TABLE, with Copy DDL.

Errors you may see

  • “ClickHouse result exceeded 8 MB or was not JSONCompact”: either the response is larger than 8 MB, or the query set its own FORMAT. Remove FORMAT, select fewer columns or aggregate.
  • ClickHouse HTTP <status>: … with a message about readonly mode: the statement tries to write or change a setting. The editor only runs reads.
  • Timeout after 15 seconds: narrow the time range or add a filter on the table’s sorting key.

Limits

  • One statement per run.
  • Up to 500 rows and 8 MB per response. Use aggregation for larger questions, and see result limits.
  • The native protocol and mutations are not available.

Frequently asked questions

Why does my ClickHouse query with FORMAT fail?

DevOpsPad reads results as JSONCompact. Remove the explicit FORMAT clause and run the query again.