Serve the timeline's connection counts from a rollup once workspaces reach millions of events

未关闭
#249 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
32/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
postgresql, sql, typescript

调研方向

Start by reading the activity_event_daily_counts rollup and its statement-level triggers from #201, then the query behind timeline_connection_event_counts and the pgTAP cases in supabase/tests/database/21_timeline_connection_event_counts.test.sql. Decide between extending the rollup with connection_id/severity or adding a sibling rollup, and reconcile London filter days against UTC rollup days. Done means the unfiltered badge renders under 100 ms at 2.3M events with explain analyze on the PR and the pgTAP cases unchanged and passing.

由索引模型根据 Issue 内容生成。

描述

area: timeline enhancement impact: low priority: P3 size: M

Summary

The timeline's connection badges (#245, PR #248) are counted by timeline_connection_event_counts, which aggregates the workspace's activity_events on every timeline render. With no filters, that reads every event the workspace keeps. Retention keeps 13 months (HISTORY_RETENTION_MONTHS in src/lib/jobs/retention.ts).

Measured with explain analyze on committed data in an isolated Postgres 17.11 container (the supabase/postgres:17.11.0.011 image, default settings):

Workspace size Filter Execution time
23,000 events (local demo) none 5.5 ms
2.3 million events (#191 scale, 13 months) none 134 to 148 ms
2.3 million events severity critical 88 ms
2.3 million events last 30 days 54 ms
2.3 million events one day 1 ms

The unfiltered case at #191 scale is over the 100 ms interactive read budget. #245 accepted this, because no workspace is near that size today. This issue holds the follow-up.

Scope

  • Extend the activity_event_daily_counts rollup (#201) with connection_id and severity, or add a sibling rollup, kept by the same statement-level triggers.
  • Serve the badges from the rollup when the filters allow it: no date filter, or whole days. The timeline's date filter uses London days and the rollup uses UTC days, so a filtered window that does not line up with UTC days still needs the live table, or a London-day rollup.
  • Keep the rule that a badge counts exactly what the timeline lists. Reuse the supabase/tests/database/21_timeline_connection_event_counts.test.sql cases against the new path.

Acceptance criteria

  • The unfiltered badges for a 2.3 million event workspace render under 100 ms (explain analyze quoted on the PR).
  • The counts are unchanged for every filter combination covered by the pgTAP test.

Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown

主要语言
TypeScript
星标
1
派生
1
平均合并
6 小时 56 分钟
30 天内合并 PR
136

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

eddiejaoude/StackDash 的其他 Issue

查看 eddiejaoude/StackDash 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。