File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2300,6 +2300,10 @@ const EnvironmentSchema = z
23002300 . int ( )
23012301 . default ( 256_000_000 ) ,
23022302 CLICKHOUSE_LOGS_LIST_MAX_THREADS : z . coerce . number ( ) . int ( ) . default ( 2 ) ,
2303+ // Logs list only: read the sort columns first and fetch the rest for the final page. Fewer
2304+ // column reads, which matters most on object storage. The settings exist from ClickHouse 25.4,
2305+ // but this query reads in sort order, which blocked lazy materialization until 25.8. Opt-in.
2306+ CLICKHOUSE_LOGS_LIST_LAZY_MATERIALIZATION : BoolEnv . default ( false ) ,
23032307 // The HTTP request timeout is derived from this so ClickHouse gives up before the client does.
23042308 CLICKHOUSE_LOGS_LIST_MAX_EXECUTION_TIME : z . coerce . number ( ) . int ( ) . default ( 15 ) ,
23052309 // Bound read-in-order memory on object-storage reads: each part opens a per-column read
Original file line number Diff line number Diff line change @@ -261,7 +261,16 @@ export class LogsListPresenter extends BasePresenter {
261261 // Run exactly one bounded query. Broadening a search window is an explicit user action;
262262 // silently rescanning the same recent rows makes absence queries needlessly expensive.
263263 const runQuery = ( ) => {
264- const queryBuilder = this . clickhouse . taskEventsSearch . logsListQueryBuilder ( ) ;
264+ const queryBuilder = this . clickhouse . taskEventsSearch . logsListQueryBuilder ( {
265+ // Scoped to this query rather than the logs client, which other pages share. ClickHouse
266+ // skips lazy materialization when LIMIT exceeds the max, so pass this query's limit.
267+ settings : env . CLICKHOUSE_LOGS_LIST_LAZY_MATERIALIZATION
268+ ? {
269+ query_plan_optimize_lazy_materialization : 1 ,
270+ query_plan_max_limit_for_lazy_materialization : queryLimit ,
271+ }
272+ : undefined ,
273+ } ) ;
265274
266275 // The projector excludes events without a trace_id.
267276 queryBuilder . where ( "trace_id != ''" ) ;
You can’t perform that action at this time.
0 commit comments