Query cost

A cost card prices one chart or query and shows how much work it does. You meet it in the Model AI chat: ask Model AI to check the cost of a chart, and its reply carries the card. A Model Builder uses the same modes when it checks how fast a model's charts are.

Read a cost card

Price a chart before you run it

Estimate prices the execution plan without running the query behind the chart.

Measure the real speed of a chart

Measured runs the query behind the chart one to three times, three by default, and reports the median. The result cache is off for these runs, so each run measures the query and not an answer the database kept from an earlier run.

See the plan of one run

Analyzed runs the query behind the chart once, with execution analysis, and reads the plan it produced.

Price an index you have not built

What if prices hypothetical indexes on the tables the chart reads. It builds nothing: the candidates live only in one session. One run prices up to six candidates on up to three stored tables.

Cost bands and refusals

When a mode is not available

Analyzed and What if need a newer database version than some servers run. On such a server the card shows Needs ClickHouse {version}, names the version the server runs, and says the mode becomes available after the upgrade; Estimate and Measured keep working. If the server's version cannot be read at the moment, the card says so and asks you to try again in a minute.

Questions, answered

Why was my chart not run?

The estimate came out over its budget (red), so the run was refused before it started. The card heads it Not run: the estimate is red: make the chart cheaper first through the performance ladder, or report the estimate as it is.

What do Fast, Watch and Slow mean?

They are the card's cost bands: Fast is the best and Slow the worst. The chip always reports the worse of the estimate's band and the measured run's band, and a run that times out or runs out of memory reads Slow.

What does "cache off" mean on a measured cost?

The measured runs repeat the query with the result cache off, so each run measures the query itself, not an answer the database kept from an earlier run.

Where do the measured timings come from?

From the runs as they complete. When every finished run could be matched in the database's own log, the card says Timings from the server's query log; when the log does not return the runs in time, the card uses the progress numbers and says so.

Why did only some of my runs count?

A run that cannot start, because no query slot was free or the call ran low on its budget, is skipped with a note; the median is computed over the runs that finished.

Why is the estimate marked approximate?

The database could not estimate on those tables, so the rows were counted from the granules the indexes keep. The figure is an approximation, not a measurement.

Why are some modes not available here?

Analyzed and What if need a newer database version. The card shows Needs ClickHouse {version} and names the version this server runs; Estimate and Measured still work. If the version cannot be read yet, try again in a minute.

Does a what-if build anything?

No. The hypothetical indexes live only in one session and nothing is built: "Nothing was built: the hypothetical indexes lived only in one ClickHouse session."

Which tables can a what-if price?

Up to three stored tables the chart reads, one estimate per table with that table's own filters. A view cannot be estimated, because hypothetical indexes exist only on stored tables.

What does "Together" mean?

It prices the best candidates as one group and shows what they would skip together, next to the best single candidate's share.

Why does the card say there is nothing to price?

Row-level security denies you every row of the chart, so the statement does not run and there is nothing to price. See Row-level security and View as.