ClickHouse / ClickHouse/ClickHouse
Include `rows_before_limit_at_least` in `X-ClickHouse-Summary` header
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
### Company or project name
_No response_
### Use case
https://github.com/ClickHouse/clickhouse-rs/issues/398
The [JSON output format](https://clickhouse.com/docs/interfaces/formats/JSON) includes a bespoke field called `rows_before_limit_at_least`:
> The lower estimate of the number of rows there would have been without LIMIT. Output only if the query contains LIMIT. This estimate is calculated from the blocks of data processed in the query pipeline before the limit transform, but could then be discarded by the limit transform. If the blocks didn't even reach the limit transform in the query pipeline, they don't participate in the estimation.
OP of the above issue, created for the Rust client, would like this added to the `X-ClickHouse-Summary` header when querying the HTTP interface, as this field is not otherwise included in a `RowBinary`/`RowBinaryWithNamesAndTypes` format response but is potentially useful to track to find candidate queries for optimization.
### Describe the solution you'd like
Add `rows_before_limit_at_least` to the `X-ClickHouse-Summary` header returned from the HTTP interface, where applicable.
We can then expose this field as part of or in extension to https://github.com/ClickHouse/clickhouse-rs/pull/397
### Describe alternatives you've considered
_No response_
### Additional context
cc @alrevuelta
Contributor guide
Assessment
This issue has not been assessed yet.