Repository navigation
Description
I think I bumped into a weird UI behaviour. To repro it easily for the screen I set the max queried rows to 5 in the config; but this happens with default amount of rows too. Version is v2.47.0
This is the "Generated SQL" of the query I'm running, notice the ORDER BY Duration DESC:
SELECT
Timestamp,
ServiceName as service,
StatusCode as level,
round(Duration / 1e6) as duration,
SpanName,
materialize(hostName()) AS replica,
toUnixTimestamp(Timestamp)
FROM
otel_traces.distributed_otel_traces
WHERE
(
Timestamp >= fromUnixTimestamp64Milli(1796381500000)
AND Timestamp <= fromUnixTimestamp64Milli(1796385100000)
)
AND (
(
(
`SpanAttributes` ['aws.s3.bucket'] = 'XXXXXXXXXXXXXX'
AND indexHint(mapContains(`SpanAttributes`, 'aws.s3.bucket'))
)
AND (ServiceName = 'XXX')
)
)
ORDER BY
Duration DESC,
Timestamp DESC
LIMIT
5
When running on the DB this SQL the result is:
┌─────────────────────Timestamp─┬─service─┬─level─┬─duration─┬─SpanName─┬─replica────────────────────────────┬─toUnixTimestamp(Timestamp)─┐
1. │ 2026-12-04 11:10:17.085063226 │ XXX │ Unset │ 160 │ HTTP GET │ clickhouse-0-0-0 │ 1796382617 │ -- 1.80 billion
2. │ 2026-12-04 11:46:07.334630365 │ XXX │ Unset │ 84 │ HTTP PUT │ clickhouse-0-0-0 │ 1796384767 │ -- 1.80 billion
3. │ 2026-12-04 11:47:09.287748311 │ XXX │ Unset │ 82 │ HTTP PUT │ clickhouse-0-0-0 │ 1796384829 │ -- 1.80 billion
4. │ 2026-12-04 11:44:09.568353399 │ XXX │ Unset │ 81 │ HTTP PUT │ clickhouse-0-0-0 │ 1796384649 │ -- 1.80 billion
5. │ 2026-12-04 11:26:07.981116895 │ XXX │ Unset │ 80 │ HTTP PUT │ clickhouse-0-0-0 │ 1796383567 │ -- 1.80 billion
└───────────────────────────────┴─────────┴───────┴──────────┴──────────┴────────────────────────────────────┴────────────────────────────┘
The queries HyperDX runs, taken from the console, are actually bucketed by Timestamp and have an OFFSET:
Sending query:
SELECT
Timestamp,
ServiceName as service,
StatusCode as level,
round(Duration / 1e6) as duration,
SpanName,
materialize(hostName()) AS replica,
toUnixTimestamp(Timestamp),
ServiceName,
toDate(Timestamp),
toDateTime(Timestamp)
FROM
otel_traces.distributed_otel_traces
WHERE
(
Timestamp >= fromUnixTimestamp64Milli(1796385040000)
AND Timestamp <= fromUnixTimestamp64Milli(1796385100000)
)
AND (
(
(
`SpanAttributes` ['aws.s3.bucket'] = 'XXXXXXXXXXXXXXXXXXX'
AND indexHint(mapContains(`SpanAttributes`, 'aws.s3.bucket'))
)
AND (ServiceName = 'XXX')
)
)
ORDER BY
Duration DESC,
Timestamp DESC
LIMIT
5 OFFSET 0 1021-97fd44dc6a95f2cb.js:1:2939
Sending query:
SELECT
Timestamp,
ServiceName as service,
StatusCode as level,
round(Duration / 1e6) as duration,
SpanName,
materialize(hostName()) AS replica,
toUnixTimestamp(Timestamp),
ServiceName,
toDate(Timestamp),
toDateTime(Timestamp)
FROM
otel_traces.distributed_otel_traces
WHERE
(
Timestamp >= fromUnixTimestamp64Milli(1796385040000)
AND Timestamp <= fromUnixTimestamp64Milli(1796385100000)
)
AND (
(
(
`SpanAttributes` ['aws.s3.bucket'] = 'XXXXXXXXXXXXXXXXXXX'
AND indexHint(mapContains(`SpanAttributes`, 'aws.s3.bucket'))
)
AND (ServiceName = 'XXX')
)
)
ORDER BY
Duration DESC,
Timestamp DESC
LIMIT
5 OFFSET 4
Sending query:
SELECT
Timestamp,
ServiceName as service,
StatusCode as level,
round(Duration / 1e6) as duration,
SpanName,
materialize(hostName()) AS replica,
toUnixTimestamp(Timestamp),
ServiceName,
toDate(Timestamp),
toDateTime(Timestamp)
FROM
otel_traces.distributed_otel_traces
WHERE
(
Timestamp >= fromUnixTimestamp64Milli(1796384140000)
AND Timestamp <= fromUnixTimestamp64Milli(1796385040000)
)
AND (
(
(
`SpanAttributes` ['aws.s3.bucket'] = 'XXXXXXXXXXXXXXXXXXX'
AND indexHint(mapContains(`SpanAttributes`, 'aws.s3.bucket'))
)
AND (ServiceName = 'XXX')
)
)
ORDER BY
Duration DESC,
Timestamp DESC
LIMIT
5 OFFSET 0
[...]
As it can be seen in the screen, the UI will render them in what seems to be the order the bucketed queries returned, instead of the actual ORDER BY that was requested. In the screen, the first OFFSET query (first of the three I reported) gets put on top and the rest of the results get appended.
This can be a rather confusing UX (notice that the top result duration: 160 is not even in the first screen, and will only be retrieved by scrolling down quite far, notice in the second screen)


Activity
[-]OFFSET queries are messing up the ORDER BY in the UI[/-][+]Timestamp bucketed queries are messing up the ORDER BY in the UI[/+]pulpdrew commentedon Dec 4, 2026
Hi @czephyr thanks for reporting - could you please share what you have configured for the source's
Timestamp Columnin the source settings? And could you share the source's schema(s)?czephyr commentedon Dec 4, 2026
Hey @pulpdrew thanks for your answer.
Timestamp Column:
Timestamp(autoselected at source creation time)DDL Schema:
pulpdrew commentedon Dec 4, 2026
Thanks again for reporting - #3907 should fix this.