The Logs Explorer's single-log lookup (`genSingleLogQueryOtel`, used by
`useSingleLog` when a row is selected) matched on `id` alone and ran over
the previewer's whole selected range. `id` is not part of the ClickHouse
logs table's sort key, so every row click scanned the entire window while
materializing `log_attributes` — the widest column in the table by a wide
margin.
Two bounds, both already available client-side:
- `AND source = '...'`, derived from the table the previewer is showing.
`source` is the second component of the sort key, so it narrows the
sorted range before the time bound applies.
- A ±1 minute `iso_timestamp_*` bracket around the selected row's own
timestamp, read from the page already in memory. Falls back to the
search range when unknown (a deep-linked `?log=<id>` that isn't in a
loaded page).
This applies the fix#47978 already made for the unified-logs inspection
query to the legacy previewer, which was missed at the time — same
reasoning, same ±1 minute window, same source-filter rationale.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>