Skip to content

Conversation

@avleentwilio
Copy link
Owner

In ClickHouse the logs and trace tables use the order:
ServiceName, TimestampTime, Timestamp
This is set by the clickhouse exporter for opentelemetry-collector-contrib.

Currently in this plugin the defaults when use_otel is enabled sets the timestamp column to Timestamp. As a result ClickHouse has to search much more data, making queries against very large tables quite slow.
On my 1.5TB logs table, Timestamp queries take 94.5s, whereas the same TimestampTime queries take 10.1s.

The correct timestamp column to use would be TimestampTime.

Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/clickhouseexporter/internal/sqltemplates/logs_table.sql

The logs and trace tables use the order:
ServiceName, TimestampTime, Timestamp

Currently the defaults when `use_otel` is enabled sets the timestamp column to `Timestamp`.
As a result ClickHouse has to search much more data, making queries against very large tables quite slow.

The correct timestamp column to use would be `TimestampTime`.

Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/clickhouseexporter/internal/sqltemplates/logs_table.sql
@avleentwilio avleentwilio merged commit a74d574 into main Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant