Files
supabase/apps
Jordi EnricandClaude Opus 4.8 aaa6b770f9 perf(unified-logs): single-scan arrayJoin facet count query
Replace the OTEL facet count query's 13x UNION ALL with a single-pass
arrayJoin "explode" over `logs`. Each row is fanned out into one row per
dimension and `multiIf` picks that dimension's value, so all facet counts
plus the total are computed in one scan instead of 13.

The output (dimension, value, count) shape is unchanged, so the consumer
in unified-logs-count-query.ts needs no changes. Reuses the existing
LOG_TYPE_EXPR / LEVEL_EXPR / STATUS_EXPR expressions.

Based on the single-scan SQL shape Chase verified against the
logs.all.otel endpoint (no CTEs / window fns / tuples / subqueries).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 13:28:34 +02:00
..