EXPLAIN indexes = 1
SELECT
Timestamp,
TraceId,
SpanId,
SpanName
FROM otel_traces
WHERE TraceId = '0f8a2c02d77d65da6b2c4d676985b3ab'
ORDER BY Timestamp ASC
Query id: 5d89d4bb-41e8-4774-955d-cae64a8d236f
┌─explain────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Expression (Projection) │
│ Sorting (Sorting for ORDER BY) │
│ Expression (Before ORDER BY) │
│ ReadFromMergeTree (otel.otel_traces) │
│ Indexes: │
│ MinMax │
│ Condition: true │
│ Parts: 34/34 │
│ Granules: 36321/36321 │
│ Partition │
│ Condition: true │
│ Parts: 34/34 │
│ Granules: 36321/36321 │
│ PrimaryKey │
│ Keys: │
│ TraceId │
│ Condition: (TraceId in ['0f8a2c02d77d65da6b2c4d676985b3ab', '0f8a2c02d77d65da6b2c4d676985b3ab']) │
│ Parts: 34/34 │
│ Granules: 36321/36321 │
│ Skip │
│ Name: idx_trace_id │
│ Description: bloom_filter GRANULARITY 1 │
│ Parts: 6/34 │
│ Granules: 50/36321 │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
EXPLAIN indexes = 1
WITH
'0f8a2c02d77d65da6b2c4d676985b3ab' AS trace_id,
(
SELECT min(Start)
FROM otel_traces_trace_id_ts
WHERE TraceId = trace_id
) AS start,
(
SELECT max(End) + 1
FROM otel_traces_trace_id_ts
WHERE TraceId = trace_id
) AS end
SELECT
Timestamp,
TraceId,
SpanId,
SpanName
FROM otel_traces
WHERE (TraceId = trace_id) AND (Timestamp >= start) AND (Timestamp <= end)
ORDER BY Timestamp ASC
┌─explain────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Expression (Projection) │
│ Sorting (Sorting for ORDER BY) │
│ Expression (Before ORDER BY) │
│ Filter (WHERE) │
│ ReadFromMergeTree (otel.otel_traces) │
│ Indexes: │
│ MinMax │
│ Keys: │
│ Timestamp │
│ Condition: and(and((Timestamp in (-Inf, '1679919497.780361794']), (Timestamp in ['1679919496.46900879', +Inf))), and((Timestamp in (-Inf, '1679919497.780361794']), (Timestamp in ['1679919496.46900879', +Inf)))) │
│ Parts: 1/34 │
│ Granules: 6921/36321 │
│ Partition │
│ Keys: │
│ toDate(Timestamp) │
│ Condition: and(and((toDate(Timestamp) in (-Inf, 19443]), (toDate(Timestamp) in [19443, +Inf))), and((toDate(Timestamp) in (-Inf, 19443]), (toDate(Timestamp) in [19443, +Inf)))) │
│ Parts: 1/1 │
│ Granules: 6921/6921 │
│ PrimaryKey │
│ Keys: │
│ toUnixTimestamp(Timestamp) │
│ TraceId │
│ Condition: and((TraceId in ['0f8a2c02d77d65da6b2c4d676985b3ab', '0f8a2c02d77d65da6b2c4d676985b3ab']), and((toUnixTimestamp(Timestamp) in (-Inf, 1679919497]), (toUnixTimestamp(Timestamp) in [1679919496, +Inf)))) │
│ Parts: 1/1 │
│ Granules: 107/6921 │
│ Skip │
│ Name: idx_trace_id │
│ Description: bloom_filter GRANULARITY 1 │
│ Parts: 1/1 │
│ Granules: 33/107 │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Created
March 28, 2023 10:37
-
-
Save gingerwizard/8749e42fbe51509a4bea33017fdd4b4f to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment